User Tools

Site Tools


lab:projects:02robust_growth_curve_modeling_using_student-t_distribution:latent_basis_gcm_in_bugs
#WinBUGS codes generated by BAUW: http://bauw.psychstat.org
#USE WITH CAUTION!

Model{
  # Model specification for linear growth curve model
  for (i in 1:NS){
    LS[i,1:2]~dmnorm(muLS[i,1:2], Inv_cov[1:2,1:2])
    muLS[i,1]<-bL[1]
    muLS[i,2]<-bS[1]
    for (t in 1:5){
      y[i, t] ~ dnorm(muY[i,t], Inv_Sig_e2[i])
      muY[i,t]<-LS[i,1]+LS[i,2]*A[t]
      # muY[i,t]<-LS[i,1]+LS[i,2]*t
    }
    w[i]~dgamma(a, a)
    Inv_Sig_e2[i]<-w[i]*Pre_e2
  }
A[1]<-0
A[2]~dnorm(0, 1.0E-2)
A[3]~dnorm(0, 1.0E-2)

A[4]~dnorm(0, 1.0E-2)

A[5]<-1
  #Priors for model parameter

  #k~dexp(0.1)
  k~dunif(0,100)
  a<-k/2

  for (i in 1:1){
    bL[i] ~ dnorm(0, 1.0E-6)
    bS[i] ~ dnorm(0, 1.0E-6)
  }
Inv_cov[1:2,1:2]<-inverse(Cov[1:2,1:2])
  Cov[1,1]~ dunif(0,100) #dgamma(.001,1000)
  Cov[2,2]~dunif(0,100)  #dgamma(.001,1000)
  Cov[1,2]<-rho*sqrt(Cov[1,1]*Cov[2,2])
  Cov[2,1]<-Cov[1,2]

  rho~dunif(-1,1)
  Pre_e2 ~ dgamma(.001, .001)

  para[6]<- 1/Pre_e2

  para[1]<-bL[1]
  para[2]<-bS[1] 
  para[3] <- Cov[1,1]
  para[4] <- Cov[2,2]
  para[5] <- Cov[1,2]
  para[7] <- k
  para[8] <- A[2]
  para[9]<-A[3]
   para[10]<-A[4]
}
lab/projects/02robust_growth_curve_modeling_using_student-t_distribution/latent_basis_gcm_in_bugs.txt · Last modified: 2016/01/24 09:48 by 127.0.0.1