| WebBUGS >> Main page Recent changes | Edit History | |
Built-in models:Unconditional linear growth curve models | ||
|---|---|---|
Model (Edit)A growth curve model is a two-level model. For the first level, we have \[ y_{it}=b_{i0}+b_{i1}t+e_{it} \] where, \(y_{it}\) is the observed data for subject \(i\) at time \(t\), \(b_{i0}\) and \(b_{i1}\) are intercept and slope, respectively, for subject \(i\). At the second level, we have \[ b_{i0} = \beta_{0}+v_{i0} \] \[ b_{i1} = \beta_{1}+v_{i1} \] We further assume that \(Var(e_{it})=\sigma^2\) and \(\mathbf{b}_i=(b_{i0}, b_{i1})'\) follows a bivariate normal distribution with mean 0 and covariance matrix D. Code (Edit)
model{
# Model specification for linear growth curve model
for (i in 1:N){
b[i,1:2]~dmnorm(beta[1:2], Inv_D[1:2,1:2])
for (t in 1:4){
y[i, t] ~ dnorm(muY[i,t], Inv_Sig_e2)
muY[i,t]<-b[i,1]+b[i,2]*t
}
}
#Priors for model parameter
for (i in 1:2){
beta[i] ~ dnorm(0, 1.0E-6)
}
Inv_D[1:2,1:2]~dwish(R[1:2,1:2], 2)
R[1,1]<-1
R[2,2]<-1
R[2,1]<-R[1,2]
R[1,2]<-0
Inv_Sig_e2 ~ dgamma(.001, .001)
Sig_e2 <- 1/Inv_Sig_e2
D[1:2,1:2]<-inverse(Inv_D[1:2,1:2])
rho_LS <- D[1,2]/sqrt(D[1,1]*D[2,2])
}
|
||
| Powered by LionWiki. Last changed: 2014/11/12 02:46 Erase cookies | Edit History | |