I could not get the code below to work. it is a hierarchical one way ANOVA model, but when I click data load the error message that appears is expected the collection operator c. What does that mean? Can anyone please help me work the code below please? My data set is bigger, but to simplify the question I am only working here with season=4 (number of groups) and n=5 (number of subjects in each group).
model{
for(i in 1:n){
Length[i] ~ dnorm(mu.l[i], tau[1])
mu.l[i] <- alpha[j[i]]
}
for (p in 1:J){
alpha[p]~dnorm(mu, tau[2])
}
mu~dnorm(0,0.0001)
for(k in 1:2){
tau[k]<-pow(sigma[k],-2)
sigma[k]~dunif( 0, 10)
}
}
#initials
list( ort=1.0, alpha=c(NA, 0,0,0), tau=c(1 ,1))
#Data
list(n=5, j=4)
j[] length[]
1 17.00
1 17.50
1 17.50
1 16.20
1 18.00
2 13.70
2 17.4
2 17.70
2 16.40
2 17.70
3 16.4
3 15.00
3 19.60
3 14.70
3 18.00
4 18.20
4 13.60
4 17.30
4 17.3
4 14.5
A few problems in your code.
In your model you have
JandLength. In your data you havej(twice) andlength, i.e. noLengthorJ.In your initial values you have
ortwhich is not a parameter used anywhere in the model andtauwhich is not stochastic (perhaps you meansigma?).Your model above should work with the following (whether it is the model you want or not is for you to decide):