Bayesian two-way ANOVA+assumption of nonhomogenous variance
A reader asks:
Dear Professor Kruschke,
I am a beginner at bayesian statistics, trying to do a BANOVA. While I managed to do them, thanks to your book and code, I am now trying to do a two-way ANOVA with the assumption that the variances are not homogenous. The problem is I can't seem to really figure out how the code (ANOVAtwowayJagsSTZ) would look if similar adaptations like with the nonhomogenous one way (ANOVAonewayNonhomogvarJagsSTZ) were done.
Perhaps it is a silly question, but while I found the change logical for oneway, I find it somehow harder to imagine for two way regarding the code.
Thanks for your interest in the book, and for your message.
I don't have a program for two-factor ANOVA with separate variances in every cell, but I can try to explain how to extend the existing program.
Instead of a single (scalar) tau in
y[i] ~ dnorm( mu[i] , tau )
there would be a matrix of tau's, one for each cell of the two-factor design:
y[i] ~ dnorm( mu[i] , tau[x1[i],x2[i]] )
At that point we have to make some choices about the prior structure on tau[,]
We could copy the prior structure on the mean deflections, and, say, model the sigma[,]=1/sqrt(tau[,]) in each cell as a baseline, factor deflection, and interaction. But that's probably overkill -- unless there are theoretical reasons to think of the cell SDs in that way. Instead, every component of tau[,] (or sigma[,]) could be expressed as coming from a gamma distribution (say), with estimated mean and sd of the gamma.