One-way ANOVA:

From last time, our model was

This is a random effects model, and .

Without the second line it’s just a fixed-effects ANOVA model.

Frequentists motivate the random effects model as if the four are a sample from a larger group. We don’t care about the identity of the individual groups. But in Bayesian approach, the random effects part is thought of as a prior on the . How to evaluate ? We might be able to guess from knowledge of the average time it takes for a child to walk (around 11 months), but what about ? Can we fix a value? Or should we put a prior on them? is the within-group variation, and is the between-group variation. is the mean time to walking over all groups. So, we’ll augment the model by putting priors on the other variables, e.g.

The prior on is rather peculiar, as it allows for the time to first walking to take place before birth! Maybe a gamma prior would be more appropriate. We investigated this.

If doing frequentist version of the model, how do you estimate ? It can be shown that for this model the posterior means are essentially where , and . w tells us how much we are pooling the data. In fixed effects, we treat all groups separately, but in random effects or the Bayesian method we are letting the overall population affect the individual group estimates. This produces the “shrinkage” effect. The fixed effects case corresponds to getting very large so that there’s not much effect of the pooled data on the individual groups.

So we ran the above model in R-WinBUGS. First looked at the fixed effects model, using lm(). The -1 in the call to lm() means “don’t fit the intercept.”

For comparison with the random effects model, we got 10.12, 11.38, 11.70, 12.35 for the four groups, with overall mean 11.38.

lmer() means “linear mixed effects model”, for fitting the random effects model. The (1 | groupf) means fit a different random intercept for each group.

Information on using lmer() can be found in two books in particular that Jeff mentioned. They are: “Mixed Effects Models in S and S+” and Gelman and Hill’s recent book, which has examples for using lmer().

Ran the code. Got 10.65, 11.38, 11.58,11.95

(Construct table of these for easy comparison).

We then set up the Bayesian analysis. This time we had the WinBUGS code in the R file, and saved it to the disk using the write.model() function. The function file.show() shows us the file.

Remember when looking at the code that while R uses the standard deviation , BUGS uses the precision.

We ran the code. Got means 10.90, 11.40, 11.48, 11.70 We noted that the between groups sigma was 1.59 whereas the within groups sigma was 0.62, a lot less variation within than between groups.

The example is from a book by Fisher and van Belle on biostatistics. It’s not a Bayesian book. We tried it with a prior on

Jeff noted that print(date()) at the beginning and end of a calculation allows him to monitor how long the calculation takes.

With the gamma prior we got 10.98,11.40,11.50, 11.74. On a second try, we got 10.94,11.38,11.49,11.72

Here’s a summary of the five computer runs we made. Run 1 was the fixed effects model, Run 2 the random effects (frequentist) model, Run 3 the Bayesian model with Jeff’s normal prior on , and Runs 4-5 the Bayesian model with the gamma prior on . You’ll notice that relative to Run 1, all of the other runs “shrink” the group estimates towards the overall mean. The shrinkage is greater for the Bayesian models than for the frequentist random effects model.

Finally, I pointed out and Jeff reinforced that the shrinkage phenomenon was first understood and explained by the great 19th century statistician, Francis Galton, a cousin of Charles Darwin. He noticed that children of tall parents tended to be shorter than their parents, and children of short parents tended to be taller than their parents. It can be understood by thinking of the variance of an observed population being composed of an underlying variance plus an individual variance. If we’re interested in the underlying variance, it will be smaller than the variance we observe in the population.

Turner asked whether the frequentist results would be the same as the Bayesian ones. The answer is “no,” because the frequentist results are in general inadmissible (a subject we’ll discuss later). The Bayesian results will be admissible as long as they are calculated using proper priors. It is also related to the Stein phenomenon.

## Leave a Reply