Home Control Panel Login Register Search Submit Logout About me Contact me
 Web This Site
 Home > My Research > BAUW > WinBUGS codes for latent basis growth curve model with varying residual variances
WinBUGS codes for latent basis growth curve model with varying residual variances
2006-11-17    Zhang, Z.       Read: 8207 times
Cite this page: Zhang, Z. (2006). WinBUGS codes for latent basis growth curve model with varying residual variances. Retrieved October 4, 2023, from http://www.psychstat.org/us/article.php/66.htm.
 WinBUGS codes for latent basis growth curve model with varying residual variances Appendix A. WinBUGS program for the latent basis model generated from BAUW #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]     Mu[i,2]<-bS[1]     for (t in 1:T){       y[i,t]~dnorm(MuY[i,t], Inv_sig_e[t])       MuY[i,t]<-LS[i,1]+LS[i,2]*A[t]     }   } #Prior distribution, can be changed to use informative prior   for (i in 1:1){     bL[i]~dnorm(0,1.0E-6)     bS[i]~dnorm(0,1.0E-6)   } # the basis coefficients can be changed here.    A[1]<-0   for (t in 2:T-1){     A[t]~dnorm(0,1.0E-6)   }   A[T]<-1   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 for (t in 1:T){   Inv_sig_e[t]~dgamma(.001,.001)   Sig_e[t]<-1/Inv_sig_e[t] }   #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])     #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[1]   Para[6]<-Sig_e[2]  Para[7]<-Sig_e[3]  Para[8]<-Sig_e[4]  Para[9]<-bL[1]  Para[10]<-bS[1]  Para[11]<-A[2]  Para[12]<-A[3]  } #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=c(1,1,1,1),   A=c(NA,0.333333,0.666667,NA),   bL=c(2),bS=c(3))   #Data   list(N=173,T=4,y = structure(.Data = c(2.6,4.9,5.5,7.2, ......1.8,3.9,NA,NA), .Dim = c(173,4))) Submitted by: johnny
 Add a comment View comment Add to my favorite Email to a friend Print