if (FALSE) {
data(data_long_cont)
# Basic LM model
out <- lmestCont(responsesFormula = Y1 + Y2 + Y3 ~ NULL,
index = c("id", "time"),
data = data_long_cont,
k = 3,
modBasic = 1,
tol = 10^-5)
out
summary(out)
# Basic LM model with model selection using BIC
out1 <- lmestCont(responsesFormula = Y1 + Y2 + Y3 ~ NULL,
index = c("id", "time"),
data = data_long_cont,
k = 1:5,
ntry = 2,
modBasic = 1,
tol = 10^-5)
out1
out1$Bic
# Basic LM model with model selection using AIC
out2 <- lmestCont(responsesFormula = Y1 + Y2 + Y3 ~ NULL,
index = c("id", "time"),
data = data_long_cont,
k = 1:5,
modBasic = 1,
ntry = 2,
modSel = "AIC",
tol = 10^-5)
out2
out2$Aic
# LM model with covariates in the measurement model
out3 <- lmestCont(responsesFormula = Y1 + Y2 + Y3 ~ X1 + X2,
index = c("id", "time"),
data = data_long_cont,
k = 3,
output = TRUE)
out3
summary(out3)
# LM model with covariates in the latent model
out4 <- lmestCont(responsesFormula = Y1 + Y2 + Y3 ~ NULL,
latentFormula = ~ X1 + X2,
index = c("id", "time"),
data = data_long_cont,
k = 3,
output = TRUE)
out4
summary(out4)
# LM model with two covariates affecting the initial probabilities and one
# affecting the transition probabilities
out5 <- lmestCont(responsesFormula = Y1 + Y2 + Y3 ~ NULL,
latentFormula = ~ X1 + X2 | X1,
index = c("id", "time"),
data = data_long_cont,
k = 3,
output = TRUE)
out5
summary(out5)
}
Run the code above in your browser using DataLab