Difference between revisions from 2013/12/27 13:42 and 2013/12/27 13:32.!Model
A growth curve model is a two-level model. For the first level, we have
{{%%
Model{
\[
y_{it}=b_{i0}+b_{i1}t+e_{it}
\]
LS[i,1:2]~dmnorm(muLS[i,1:2], Inv_cov[1:2,1:2])
%%}}
muLS[i,1]<-bL[1]
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
muLS[i,2]<-bS[1]
{{%%
\[
b_{i0} = \beta_{0}+v_{i0}
muY[i,t]<-LS[i,1]+LS[i,2]*t
\]
\[
b_{i1} = \beta_{1}+v_{i1}
\]
%%}}
for (i in 1:1){
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'''.
bL[i] ~ dnorm(0, 1.0E-6)
bS[i] ~ dnorm(0, 1.0E-6)
model{
Inv_cov[1:2,1:2]~dwish(R[1:2,1:2], 2)
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
}
Cov[1:2,1:2]<-inverse(Inv_cov[1:2,1:2])
Sig_L2 <- Cov[1,1]
Sig_S2 <- Cov[2,2]
Cov_LS <- Cov[1,2]
for (i in 1:2){
rho_LS <- Cov[1,2]/sqrt(Cov[1,1]*Cov[2,2])
beta[i] ~ dnorm(0, 1.0E-6)
}
Inv_D[1:2,1:2]~dwish(R[1:2,1:2], 2)
# The (naive) starting values for model parameters.
list(bL=c(0), bS = c(0), Inv_Sig_e2 = 1,
Inv_cov= structure(.Data = c(1,0,0,1),.Dim=c(2,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])
}
}}
|