Processing math: 100%

WebBUGS >> Main page Recent changes Show source History

Built-in models:Unconditional robust linear growth curve models

Model

A growth curve model is a two-level model. For the first level, we have

yit=bi0+bi1t+eit

where, yit is the observed data for subject i at time t, bi0 and bi1 are intercept and slope, respectively, for subject i. At the second level, we have

bi0=β1+vi0 bi1=β2+vi1

We bi=(bi0,bi1) follows a bivariate normal distribution with mean 0 and covariance matrix D. We further assume that eit follows a t distribution with mean 0, scale σ2 and degrees of freedom ν .

Code

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] ~ 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:2){
    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:47 Erase cookies Show source History