# \donttest{
#Compare model-based clustering with respect to another classification
# Set up initial values and hyper parameters (either fixed or random)
iter<-5 # number of iterations for the Gibbs sampler
burn<-0
num.cluster <- 3 # number of components
states <- 5 # number of states
ini.constr<-c(1, 0, 1, 1, 1) # constrains on initial probabilities
trans.constr<-matrix(c(1, 1, 1, 0, 1, # constrains on transition probabilities
1, 0, 1, 1, 1,
1, 1, 1, 1, 0,
0, 1, 1, 1, 1,
1, 1, 0, 1, 1),byrow=TRUE,nrow=5)
# parameters initial values
A.ini <- 1/states*matrix(rep(1, length = (states^2)),
nrow = states, byrow = TRUE,
dimnames = list(as.character(c(1:states))) )
pi.ini <- rep(1/states, length = states)
# Prior distributions' hyperparameters
prior.ini<- prior.transrow <- prior.mixcoef <- 1
# data is the simulated sequential dataset obtained in the sim_seq() example
# Run the MCMC to estimate parameters
MMM_1 <- fit_mixmar(data, iter, burn, num.cluster = num.cluster, states = states,
A.ini = A.ini, pi.ini = pi.ini, prior.ini = prior.ini,
prior.transrow = prior.transrow, prior.mixcoef = prior.mixcoef,
ini.constr = ini.constr, trans.constr = trans.constr)
# }
Run the code above in your browser using DataLab