# NOT RUN {
data(d_carconf)
K <- ncol(d_carconf)
## Fit 1- and 2-component PL mixtures via MAP estimation
MAP_1 <- mapPLMIX_multistart(pi_inv=d_carconf, K=K, G=1,
n_start=2, n_iter=400*1)
MAP_2 <- mapPLMIX_multistart(pi_inv=d_carconf, K=K, G=2,
n_start=2, n_iter=400*2)
mcmc_iter <- 30
burnin <- 10
## Fit 1- and 2-component PL mixtures via Gibbs sampling procedure
GIBBS_1 <- gibbsPLMIX(pi_inv=d_carconf, K=K, G=1, n_iter=mcmc_iter,
n_burn=burnin, init=list(p=MAP_1$mod$P_map,
z=binary_group_ind(MAP_1$mod$class_map,G=1)))
GIBBS_2 <- gibbsPLMIX(pi_inv=d_carconf, K=K, G=2, n_iter=mcmc_iter,
n_burn=burnin, init=list(p=MAP_2$mod$P_map,
z=binary_group_ind(MAP_2$mod$class_map,G=2)))
## Select the optimal number of components
SELECT <- selectPLMIX(pi_inv=d_carconf, seq_G=1:2,
MAPestP=list(MAP_1$mod$P_map, MAP_2$mod$P_map),
MAPestW=list(MAP_1$mod$W_map, MAP_2$mod$W_map),
deviance=list(GIBBS_1$deviance, GIBBS_2$deviance))
SELECT$criteria
# }
Run the code above in your browser using DataLab