User Tools

Site Tools


lab:projects:13applying_student_t_distribution_on_observed_variables_or_latent_variables:normal_data_model_bugs_codes
#WinBUGS codes generated by BAUW: http://bauw.psychstat.org
#USE WITH CAUTION!

Model{
  # Model specification for linear growth curve model
  for (i in 1:N){
    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)
      muY[i,t]<-LS[i,1]+LS[i,2]*t
    }
  }

  #Priors for model parameter
  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]~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
  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]
  rho_LS <- Cov[1,2]/sqrt(Cov[1,1]*Cov[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)))

# Please put your data here. Remeber you can convert your data by BAUW--Convert Data. :)
lab/projects/13applying_student_t_distribution_on_observed_variables_or_latent_variables/normal_data_model_bugs_codes.txt · Last modified: 2016/01/24 09:48 by 127.0.0.1