est_lm_mixed | R Documentation |
Main function for estimating the mixed LM model with discrete random effect in the latent model.
The function is no longer maintained. Please look at lmestMixed
function
est_lm_mixed(S, yv = rep(1,nrow(S)), k1, k2, start = 0, tol = 10^-8, maxit = 1000,
out_se = FALSE)
S |
array of available response configurations (n x TT x r) with categories starting from 0 |
yv |
vector of frequencies of the available configurations |
k1 |
number of latent classes |
k2 |
number of latent states |
start |
type of starting values (0 = deterministic, 1 = random) |
tol |
tolerance level for convergence |
maxit |
maximum number of iterations of the algorithm |
out_se |
to compute standard errors |
la |
estimate of the mass probability vector (distribution of the random effects) |
Piv |
estimate of initial probabilities |
Pi |
estimate of transition probability matrices |
Psi |
estimate of conditional response probabilities |
lk |
maximum log-likelihood |
W |
posterior probabilities of the random effect |
np |
number of free parameters |
bic |
value of BIC for model selection |
call |
command used to call the function |
Francesco Bartolucci, Silvia Pandolfi - University of Perugia (IT)
Bartolucci, F., Farcomeni, A. and Pennoni, F. (2013) Latent Markov Models for Longitudinal Data, Chapman and Hall/CRC press.
## Not run:
# Example based of criminal data
# load data
data(data_criminal_sim)
out <- long2wide(data_criminal_sim, "id", "time", "sex",
c("y1","y2","y3","y4","y5","y6","y7","y8","y9","y10"), aggr = T, full = 999)
XX <- out$XX
YY <- out$YY
freq <- out$freq
n1 <- sum(freq[XX[,1] == 1])
n2 <- sum(freq[XX[,1] == 2])
n <- sum(freq)
# fit mixed LM model only for females
YY <- YY[XX[,1] == 2,,]
freq <- freq[XX[,1] == 2]
k1 <- 2
k2 <- 2
res <- est_lm_mixed(YY, freq, k1, k2, tol = 10^-8)
summary(res)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.