4
$\begingroup$

I have a set of $N$ bodies, which is a random sample from a population whose mean and variance I want to estimate. A property of each body is being measured $m_i$ times ($m_i>1$) and different for each body index $i$ identifies which body it is; the property is expected to be distributed around zero). I would like to describe the resulting measurement. Particularly I'm interested in average property value and in the variance.

The average value is simple. First calculate the mean values for each body and then calculate the mean of means.

The variance is more tricky. There are two variances: the variance of measurement and the variance of property values. In order to have an idea on the confidence we have in any single measurement, we need to account for both the sources. Unfortunately, I can't think of a good method. It is obvious that putting all the numbers in a single pool and calculating the stdev of this pool isn't a good idea.

Any suggestion?

EDIT Colin Gillespie suggests applying Random Effects Model. This model seems to be the right solution for my case, except for the fact that it is described (in Wikipedia) for the cases where each group (body in my case) is sampled equally ($m_i$ is constant for all the bodies), which is not correct in my case

$\endgroup$
1
  • 3
    $\begingroup$ The m_i's do not have to be equal Wikipedia has a simplified description of the model. $\endgroup$ Commented Jul 20, 2010 at 14:17

1 Answer 1

7
$\begingroup$

I think if I understand your description correctly, you need to use a linear mixed model. However, this maybe overkill, since these models are used to find differences between groups. For example, if you have two types of bodies and you wish to determine if they are different.

Basically, you have between subject variation and within subject variation.

To fit these models in R, you can use the lmer function from the lme4 library. So if I understand you correctly, your function will look something like this:

#Load the R library
library(lme4)

#data is a R data frame that contains your data
#measurement and Subject are variables
fm1 = lmer(measurement ~ (1|Subject), data)

If you are looking for differences between bodies, then it will look something like:

fm2 = lmer(measurement ~ body + (body|Subject), data)

The command summary(fm1) should give the values you are after.

Here are some resources that will help you get started:

  1. Documentation for the lme4 package
  2. Statistics with R

Most statistical software will be able to fit models of this type.

BTW, the subject part is usually called the random effect. However, there a many different views on what a random effect is. See Ch11.4 of Data analysis using regression by Gelman and Hill for more details.

$\endgroup$
1
  • $\begingroup$ Colin, I tried to figure out how to expand the Wikipedia formulae to non-equal m_i's, but didn't have any success. Can you please help me with this? (sorry) $\endgroup$ Commented Jul 20, 2010 at 16:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.