I am reading from Quinn and Keough's book. In chapter Correlation and Regression, section Fixed X, at page 94, they say

Linear regressions analysis assumes that the $x_i$ are known constants, i.e. they are fixed values controlled or set by the investigator with no variance associated with them. A linear model in which the predictor variables are fixed is known as Model I or a fixed effects model. This will often be the case in designed experiments where the levels of X are treatments chosen specifically. In these circumstances, we would commonly have replicate Y-values for each $x_i$ and X may well be a qualitative variable, so analyses that compare mean values of treatment groups might be more appropriate [..]. The fixed X assumption is probably not met for most regression analyses in biology because X and Y are usually both random variables recorded from a bivariate distribution. For example, Peake and Quinn (1993) did not choose mussel clumps of fixed areas but took a haphazard sample of clumps from the shore [..].


I used to think of that variables that should be integrated as random effects are those for which measurements was made with some level of inaccuracy and I am not sure this is what this quote is referring to. My question is

Are random effects used for explanatory variables measured with inaccuracy or for explanatory variables designating a subset of groups that are sampled?

Note that I am a little bit confused in how to think of these concepts in both the contexts of linear regressions and ANOVAs.

I would like to clarify my misunderstandings via two examples.

Example 1

Alice scuba dived, looked for anemones and for each one of them she measured their size and their depth. The question is "Does depth affect anemonea size?".

I can think of two potential reasons why depth should be modelled as a random effect:

  • Because the depth was measured with some inaccuracy (specific to the depth meter Alice used)

  • Because Alice has not exhaustively (and in the right proportions) sampled all the possible depths of interest.

Example 2

Alice went on the sea shore and randomly sampled mussel clumps. For each clump sampled, she counted the number of individual mussels and the number of species of mussels. The question is "Is the number of species of mussels affecting the number of individuals".

The counts are perfectly known (no inaccuracy in the measurement). From the above quote, I can still think of a reason why Alice should model the explanatory variable as a random effect; Alice haphazardly sampled clumps and a future study could have sampled different clumps. If all the clumps were sampled, then Alice should use a fixed effect model.

  • $\begingroup$ Please be brief and indicate specfic goal. Seems to be a some-what weird question. $\endgroup$ May 10 '18 at 4:07

The term “random effect” does not mean “something that is random”, it refers to something in a hierarchical or mixed model that is not a population-level effect.

Suppose I have some adorable newborn Great Dane puppies, and I feed them a special puppy supplement that I think will help them grow larger than they would without the supplement. I give different puppies different doses, and I measure their weights when they’re grown and fit a model of “weight = intercept + beta*supplement_dose”. My intercept here is the expected weight of a puppy who was not given the supplement, and my slope is “the increase in weight per unit dose of supplement”.

Now, suppose I do this with multiple litters of Great Dane puppies. Due to factors like their parents’ genetics and their mothers’ nutrition during pregnancy, some of the litters have bigger puppies than others. Littermates are more alike with each-other than with other puppies, so I no longer have independence of observations - if I fit a regular linear model here, I will calculate the variance incorrectly and my standard errors and p-values will be wrong.

So I add a random effect for litter, specifically a random intercept. This means that now in addition to the model having its overall intercept (a fixed effect) each litter also gets its own separate intercept to account for the fact that some litters have bigger puppies than other litters. My fixed effect intercept is now kind of a weird averaged-across-litters expected weight of a puppy not given supplement. But since that differs by litter, I have to add the litter-specific intercept to get the expected weight of a puppy from litter #7 who was not given supplement (which may be different from the expected weight of a puppy from litter #3 who was not given supplement). The random intercept for litter #7 is “the effect of being in litter #7 on the weight of a puppy”. It has no meaning at the population level, but because it is part of the structure of my data I have to account for it or I will miscalculate the variance of other things in the model.

Random intercepts aren’t the only kind of random effect. Suppose I did the same experiment again, but this time I used litters from different breeds. I have a litter of Great Danes, a few mixed-breed litters of various ancestries, and a litter of Chihuahuas. If they all gain three pounds per gram of supplement, I am going to end up with some really big Chihuahuas... more likely, I may find that while the Great Danes gain 3 pounds per gram of supplement, the Chihuahuas gain 0.25 pounds per gram of supplement, and each mixed-breed litter gains different amounts of weight too. So the slope of weight gain relative to supplement dose now also differs between litters. I can add a random effect for slope to allow slope to vary between litters like that, while still being able to look at my overall question “does the supplement make puppies bigger?”

The important thing with random effects is that they’re usually something that’s meaningless at the population level. “The effect of being in litter #7 on weight of puppy.” There is never going to be another litter #7 exactly like that with exactly the same effect on puppy size again. It’s something meaningless/random that I can’t make any useful inferences about, but that I still have to account for in order to correctly model the situation.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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