0

Does anyone know how to calculate the mean in a clustered dataset? I've obtained data in children from 145 households; each household has between 1 and 6 children. Among other I've collected data on weight and height, and is thus able to calculate a so-called z-score for weight-for-height. I wish to calculate the mean of this z-score, but I don't know how to calculate it, if I have to account for the clustering (children are clustered within the households). I use R for statistical analysis.

Hope you can help!

  • 1
    Please provide enough code so others can better understand or reproduce the problem. – Community Mar 09 '22 at 16:58
  • Thanks for the response. Problem is, I don't even know which code to use yet, so it is a statistical question, really. I suspect I'll need the lme4-package, as that is for hierarchial data, but I'm not sure. Sorry for the sparse data/code foundation.. – Janni Bækkelund Petersen Mar 09 '22 at 17:04
  • Take a look at https://stackoverflow.com/q/11562656/3358272, summarizing by group. – r2evans Mar 09 '22 at 17:24
  • 1
    The Community Bot's comment was under-informed; a better suggestion: Questions on SO (especially in R) do much better if they are reproducible and self-contained. By that I mean including attempted code (please be explicit about non-base packages), sample representative data (perhaps via `dput(head(x))` or building data programmatically (e.g., `data.frame(...)`), possibly stochastically), perhaps actual output (with verbatim errors/warnings) versus intended output. Refs: https://stackoverflow.com/q/5963269, [mcve], and https://stackoverflow.com/tags/r/info. – r2evans Mar 09 '22 at 17:24

0 Answers0