if (FALSE) {
# Example based on criminal data
# load criminal data
data(data_criminal_sim)
#We consider the response variable referring of crime of type 5
out <- long2wide(data_criminal_sim, "id", "time", "sex",
"y5", aggr = T, full = 999)
XX <- out$XX-1
YY <- out$YY
freq <- out$freq
TT <- 6
X1 <- as.matrix(XX[,1])
X2 <- as.matrix(XX[,2:TT])
# estimate the model
res <- est_mc_cov(S = YY, yv = freq, X1 = X1, X2 = X2, output = TRUE)
summary(res)
# Initial probability for female
Piv0 <- round(colMeans(res$Piv[X1 == 0,]), 4)
# Initial probability for male
Piv1 <- round(colMeans(res$Piv[X1 == 1,]), 4)
}
Run the code above in your browser using DataLab