Dear All,
I am trying to fit a latent class model in Winbugs. I assume that each
class has it own mean and variance covariance matrix. I use a categorical
distribution to assign the subject i to a class, the command is
T[i]~dcat(pro[])
Beta[i,1:4]~dmnorm(MB[T[i],], Inv_covs [1:4,1:4])
As you see from above expression, the parameters within each class has mean
MB[T[i],], but I do not know how to specify different variance-covariance
matrix for each class. In above expression, I assume that all individuals,
no matter which class they belong to, have same variance covariance matrix,
I specify its inverse is Inv_covs[1:4,1:4]. However, this is not my
purpose, does anyone know how to specify different variance covariance
matrix for each class?
Thanks a lot
The model is
model{
for(i in 1:100) {
T[i]~dcat(pro[])
Beta[i,1:4]~dmnorm(MB[T[i],], Inv_covs[1:4,1:4])
for (k in 1:8) {Y[i,k]~dnorm(Mu[i,k], tauc[i])
Mu[i,k]<-Beta[i,1]*x[k,1]+Beta[i,2]*x[k,2]+Beta[i,3]*x[k,3]+Beta[i,4]*x[k,4]}}
MB[1,1:4]~dmnorm(theta01[1:4], Inv_cov01[1:4,1:4])
MB[2,1:4]~dmnorm(theta02[1:4], Inv_cov02[1:4,1:4])
pro[1]<-0.4
pro[2]<-0.6
Inv_covs[1:4,1:4]~dwish(R[1:4, 1:4],4)
for (a in 1:4){theta01[a]<-0}
for (b in 1:4){theta02[b]<-0}
for (c in 1:4){for(d in 1:4){Inv_cov01[c,d]<-0}}
for (e in 1:4){for(f in 1:4){Inv_cov02[e,f]<-0}}
R[1,1]<-1
R[1,2]<-0
R[1,3]<-0
R[1,4]<-0
R[2,1]<-0
R[2,2]<-1
R[2,3]<-0
R[2,4]<-0
R[3,1]<-0
R[3,2]<-0
R[3,3]<-1
R[3,4]<-0
R[4,1]<-0
R[4,2]<-0
R[4,3]<-0
R[4,4]<-1
for (v in 1: 100) {tauc[v]~dgamma(0.001,0.001)}
beta11<-MB[1,1]
beta12<-MB[1,2]
beta13<-MB[1,3]
beta14<-MB[1,4]
beta21<-MB[2,1]
beta22<-MB[2,2]
beta23<-MB[2,3]
beta24<-MB[2,4]
_________________________________________________________________
Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn/
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|