Hi All,
I have a hierarchical Bayes model that looks like:
The model is basically a repeated measures RCT with observations at baseline, week 1,4,12, and 24. So the data is nested under participant.
I also have another nesting called tid. What I want to do is to be able to alter the code above to account for this additional nesting. Something like the lme4 type model:
Any help on how to modify the bugs/JAGS script above to be able to do this would be greatly appreciated.
I have a hierarchical Bayes model that looks like:
Code:
model{
#Overaching model
for (i in 1:n){
y[i] ~ dnorm (yHat[i], tau.y)
yHat[i] <- a[id[i]] + b.group*group[i] + b.wave*wave[i] + b.int*wave[i]*group[i]
}
#Fixed Effects
b.group ~ dnorm(0, .0001)
b.wave ~ dnorm(0, .0001)
b.int ~ dnorm(0, .0001)
#For missing y
tau.y <- pow(sigma.y, -2)
sigma.y ~ dunif (0, 100)
#Loop through id
for (j in 1:S2) {
a[j] ~dnorm(mu.a, tau.a)
}
#Random Effects
mu.a ~ dnorm(0, .0001)
tau.a <- pow(sigma.a, -2)
sigma.a ~ dunif (0, 100)
#Effect of group at particular points in time
b1 <- b.group + b.int*1
b4 <- b.group + b.int*4
b12 <- b.group + b.int*12
b24 <- b.group + b.int*24
}
I also have another nesting called tid. What I want to do is to be able to alter the code above to account for this additional nesting. Something like the lme4 type model:
Code:
lmer(y ~ group*wave + (1|id) + (1|tid), data=temp)