est_lm_mixed: Estimate mixed LM model

Description Usage Arguments Value Author(s) References Examples

View source: R/est_old.R

Description

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

Usage

1
2
est_lm_mixed(S, yv = rep(1,nrow(S)), k1, k2, start = 0, tol = 10^-8, maxit = 1000,
                    out_se = FALSE)

Arguments

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

Value

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

Author(s)

Francesco Bartolucci, Silvia Pandolfi - University of Perugia (IT)

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## 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)

LMest documentation built on Oct. 10, 2021, 1:09 a.m.