Growth curve models - Linear growth curve model
2006-05-31    Zhang, Zhiyong   
Print from: Zhiyong Zhang \'s Psychometric Website
Address: https://www.psychstat.org/us/article.php/56
Growth curve models - Linear growth curve model

NOTE: BAUW is being replaced by a OpenBUGS plugin now. The plugin can be downloaded at http://psychstat.org/us/images/upfile/Bauw.rar. The plugin only works for OpenBUGS not WinBUGS. However, the scripts working in OpenBUGS generally work for WinBUGS, too. To install the plugin, simple unzip the downlowd to the OpenBUGS folder. A menu item "BAUW" should appear in your OpenBUGS window. This plugin has most of the functions BAUW has. Questions and comments are welcome.

Model

One form of the linear growth curve models is

yit=Li+Si*t+eit, i=1,..., N, t=1, ..., T

Li=bL1+bL2*x1i+bL3*x2i+...+eLi

Si=bS1+bS2*x1i+bS3*x2i+...+eSi

 where x1i , x2i ... are covariates.

 

Data file

For the linear growth curve model with covariates, the data in the data file need to be formated. In each row (for one participants), the variables ordered like,

Data at time 1, data at time 2, ... data at time T,  Covariate 1, Covariate 2

V1, V2, ..., VT, X1, X2.

The covariates follow the data at each occasion.

Generate codes

1. Analyze-Growth curve models - Linear growth curve model.

2. Type in the required fields.

3. Click "OK".

Note. Number of covariate can be 0, means no covariate.

A sample program with 1 covariate looks like,

# WinBUGS codes for the linear growth rate models
# generated by BAUW, a free program by Zhang, Z. and Wang, L. (2006)

#model specification
model{
  for (i in 1:N){
    LS[i,1:2]~dmnorm(Mu[i,1:2], Inv_cov[1:2,1:2])
    Mu[i,1]<-bL[1]+bL[2]*y[i,T+1]
    Mu[i,2]<-bS[1]+bS[2]*y[i,T+1]
    for (t in 1:T){
      y[i,t]~dnorm(MuY[i,t], Inv_sig_e)
      MuY[i,t]<-LS[i,1]+LS[i,2]*t
    }
  }
#Prior distribution, can be changed to use informative prior
  for (i in 1:2){
    bL[i]~dnorm(0,1.0E-6)
    bS[i]~dnorm(0,1.0E-6)
  }
  Inv_cov[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_e~dgamma(.001,.001)
  #Transform the parameters
  Cov[1:2,1:2]<-inverse(Inv_cov[1:2,1:2])
  Sig_L<-Cov[1,1]
  Sig_S<-Cov[2,2]
  rho<-Cov[1,2]/sqrt(Cov[1,1]*Cov[2,2])
  Sig_e<-1/Inv_sig_e
  #all parameter are put into Para
  Para[1]<-Sig_L
  Para[2]<-Sig_S
  Para[3]<-Cov[1,2]
  Para[4]<-rho
  Para[5]<-Sig_e
  Para[6]<-bL[1]
  Para[7]<-bL[2]
  Para[8]<-bS[1]
  Para[9]<-bS[2]
 } #end of model part

#Starting values
#You can change the starting values by yourself here.
 list(Inv_cov= structure(.Data = c(1,0,0,1),.Dim=c(2,2)), Inv_sig_e=1,
 bL=c(0,0), bS=c(0,0))

#Data

A user who would like to include a reference to BAUW in a journal article may use the following format (Publication Manual of the American Psychological Association, Fifth Edition, Example 83, page 280):
Zhang, Z., & Wang, L. (2006).BAUW: Bayesian Analysis Uinsg WinBUGS, Version 1.0. Computer software and manual]. Retrieved from
http://bauw.psychstat.org

Editor: johnny