WebBUGS >> Main page Recent changes Show source History

Built-in models:Conditional robust linear growth curve models

Model

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\). Suppose there are two subject level predictors \(x_{1i}\) an \(x_{2i}\). At the second level, we have

\[ b_{i0} = \beta_{1}+\beta_{2}x_{1i}+\beta_{3}x_{2i}+v_{i0} \] \[ b_{i1} = \beta_{4}+\beta_{5}x_{1i}+\beta_{6}x_{2i}+v_{i1} \]

We \(\mathbf{b}_i=(b_{i0}, b_{i1})'\) follows a bivariate normal distribution with mean 0 and covariance matrix D. We further assume that \(e_{it}\) follows a t distribution with mean 0, scale \(\sigma^2\) and degrees of freedom \(\nu\) .

Code

model{
  # Model specification for linear growth curve model
  for (i in 1:N){
    b[i,1:2]~dmnorm(mub[i, 1:2], Inv_D[1:2,1:2])
    mub[i,1]<-beta[1]+beta[2]*x1[i]+beta[3]*x2[i]
    mub[i,2]<-beta[4]+beta[5]*x1[i]+beta[6]*x2[i]
    for (t in 1:4){
      y[i, t] ~ dt(muY[i,t], Inv_Sig_e2, v)
      muY[i,t]<-b[i,1]+b[i,2]*t
    }
  }

  #Priors for model parameter
  for (i in 1:6){
    beta[i] ~ dnorm(0, 1.0E-6)
  }
  v~dunif(0,100)
  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/11 21:48 Erase cookies Show source History