I try to analyze a split-plot design and try to get my head around the code. My problem is that we were only able to gather a convenience sample of patients grouped into 11 different disorders at 2 measurement times, so a 2x11 design with nominal predictors, from which one is a repeated measurement. The y-variable is metric.
The script *Jags-Ymet-XnomSplitPlot-MnormalHom.R* from Kruschke’s DBDA book for homogenous variances and a normally distributed y seems to work fine. But, since sample sizes for each group are very, very different and it may be expected that different groups reacted differently from pre to post, I think a robust estimation for y is reasonable and more importantly, to allow for the estimation of heterogenous variances for each group within each measurement time. I only found the code for homogenous variances for the split-plot design and therefore tried to understand the differences in the codes for simple and robust 2-factorial designs without repeated measurements. I can see that y is estimated with a t-distribution of course (no problem to adapt it for the split plot design I think), but I do not understand the estimation for the heterogenous variances in the *Jags-Ymet-Xnom2fac-MrobustHet.R* script :
for ( j1 in 1:Nx1Lvl ) { for ( j2 in 1:Nx2Lvl ) { sigma[j1,j2] ~ dgamma( sigmaSh , sigmaRa ) # Prevent from dropping too close to zero: ySigma[j1,j2]