(This article was originally published at Statistical Modeling, Causal Inference, and Social Science, and syndicated at StatsBlogs.)

Jim Thomson writes:

I wonder if you could provide some clarification on the correct way to calculate the finite-population standard deviations for interaction terms in your Bayesian approach to ANOVA (as explained in your 2005 paper, and Gelman and Hill 2007).

I understand that it is the SD of the constrained batch coefficients that is of interest, but in most WinBUGS examples I have seen, the SDs are all calculated directly as sd.fin<-sd(beta.main[]) for main effects and sd(beta.int[,]) for interaction effects, where beta.main and beta.int are the unconstrained coefficients, e.g. beta.int[i,j]~dnorm(0,tau).

For main effects, I can see that it makes no difference, since the constrained value is calculated by subtracting the mean, and sd(B[]) = sd(B[]-mean(B[])).

But the conventional sum-to-zero constraint for interaction terms in linear models is more complicated than subtracting the mean (there are only (n1-1)*(n2-1) free coefficients for an interaction b/w factors with n1 and n2 levels). When I estimate a model with constrained coefficients directly the SD of those constrained coefficients is different to the SD of unconstrained coefficients for the same model, and I am assuming the later are incorrect?

Can you confirm that the finite pop SD must be calculated from the constrained coefficients, and that sd(beta.int[,]) will not be correct for interaction terms?

It would be great if sd(beta.int[,]) were valid, because using constrained coefficients slows WinBUGS down considerably, but I can’t see that it is (unless I am misunderstanding the constraints).

My reply:

Yes, I find it more complicated with interactions because then I do in fact subtract row means and column means (ab[i,j] – a[i] – b[j] + mu). It’s do-able but I feel a little uncomfortable doing all this post-processing of inferences. I have this feeling that if I really were doing things right, everything would just pop out of the model. The post-processing feels too much like a duplication.

**Please comment on the article here:** **Statistical Modeling, Causal Inference, and Social Science**