#simulate 3 chains with 4 states of length 1500. There is one (constant) covariate. The beta parameters are for the pi probabilities and the gamma parameters are for the phi probabilities. These are the same parameters used to generate dataEG1
chain <- sim.chain( n.chains=3, n.obs=rep( 1500, 3), n.cats=4, n.covars=1, beta=c(0,0.3,-0.3,0), gamma=c(0.5,0.2,1,0))
#Plot the first 100 observations of each chain
par( mfrow=c(3,1))
for( ii in 1:3){
tmpDat <- chain[chain[,"chain"]==ii,]
plot( 1:100, tmpDat[1:100,"state"], main=paste( "Chain", ii), ylab="State", xlab="Index", type='b', pch=20)
abline(h=1:4, lty=2)
}
Run the code above in your browser using DataLab