Learn R Programming

LMest (version 3.1.2)

est_lm_cov_latent_cont: Estimate LM model for continuous outcomes with covariates in the latent model

Description

Main function for estimating the LM model for continuous outcomes with covariates in the latent model.

The function is no longer maintained. Please look at lmestCont function.

Usage

est_lm_cov_latent_cont(Y, X1 = NULL, X2 = NULL, yv = rep(1,nrow(Y)), k, start = 0,
                       tol = 10^-8, maxit = 1000, param = "multilogit",
                       Mu = NULL, Si = NULL, Be = NULL, Ga = NULL,
                       output = FALSE, out_se = FALSE)

Value

lk

maximum log-likelihood

Be

estimated array of the parameters affecting the logit for the initial probabilities

Ga

estimated array of the parameters affecting the logit for the transition probabilities

Mu

estimate of conditional means of the response variables

Si

estimate of var-cov matrix common to all states

np

number of free parameters

aic

value of AIC for model selection

bic

value of BIC for model selection

lkv

log-likelihood trace at every step

Piv

estimate of initial probability matrix

PI

estimate of transition probability matrices

Ul

matrix containing the predicted sequence of latent states by the local decoding method

call

command used to call the function

Arguments

Y

array of continuous outcomes (n x TT x r)

X1

matrix of covariates affecting the initial probabilities (n x nc1)

X2

array of covariates affecting the transition probabilities (n x TT-1 x nc2)

yv

vector of frequencies of the available configurations

k

number of latent states

start

type of starting values (0 = deterministic, 1 = random, 2 = initial values in input)

tol

tolerance level for checking convergence of the algorithm

maxit

maximum number of iterations of the algorithm

param

type of parametrization for the transition probabilities ("multilogit" = standard multinomial logit for every row of the transition matrix, "difflogit" = multinomial logit based on the difference between two sets of parameters)

Mu

initial value of the conditional means (r x k) (if start=2)

Si

initial value of the var-cov matrix common to all states (r x r) (if start=2)

Be

intial value of the parameters affecting the logit for the initial probabilities (if start=2)

Ga

intial value of the parametes affecting the logit for the transition probabilities (if start=2)

output

to return additional output (V,PI,Piv,Ul)

out_se

to compute the information matrix and standard errors

Author

Francesco Bartolucci, Silvia Pandolfi, University of Perugia, http://www.stat.unipg.it/bartolucci

References

Bartolucci, F., Farcomeni, A. and Pennoni, F. (2013) Latent Markov Models for Longitudinal Data, Chapman and Hall/CRC press.

Examples

Run this code
if (FALSE) {
# Example based on multivariate longitudinal continuous data

data(data_long_cont)
TT <- 5
res <- long2matrices(data_long_cont$id, X = cbind(data_long_cont$X1, data_long_cont$X2),
      Y = cbind(data_long_cont$Y1, data_long_cont$Y2, data_long_cont$Y3))
Y <- res$YY
X1 <- res$XX[,1,]
X2 <- res$XX[,2:TT,]

# estimate the model
est <- est_lm_cov_latent_cont(Y, X1, X2, k = 3, output = TRUE)
summary(est)

# average transition probability matrix
PI <- round(apply(est$PI[,,,2:TT], c(1,2), mean), 4)
PI
}

Run the code above in your browser using DataLab