Thin extender over lcmm::lcmm for the
Proust-Lima et al. (2017) latent-class linear mixed model on
longitudinal / repeated-measures data.
Arguments
- fixed
A two-sided formula for the fixed-effects part of the model.
- random
A one-sided formula for the random-effects part (default
~1, random intercept only).- subject
Character; the name of the column in
dataidentifying the subject / grouping variable.- data
A data frame containing the variables in
fixed,random, andsubject.- ng
Integer; the number of latent classes (default
2).- ...
Further arguments forwarded to
lcmm::lcmm(e.g.mixture,classmb,idiag,nwg,link,intnodes,epsa,epsb,epsd,maxiter,B,convB,convL,convG,verbose).
Value
A list with $method = "lcmm::lcmm" and $raw
(an lcmm object with the class-membership probabilities,
class-specific fixed-effect estimates, and convergence
diagnostics).
Examples
# \donttest{
if (requireNamespace("lcmm", quietly = TRUE)) {
data("data_hlme", package = "lcmm")
# lcmm needs initial values when ng > 1: fit the one-class
# model first and seed the two-class fit from it (B = ...).
m1 <- morie_lcmm_latent_class(
fixed = Y ~ Time,
random = ~ Time,
subject = "ID",
data = data_hlme,
ng = 1
)
morie_lcmm_latent_class(
fixed = Y ~ Time,
random = ~ Time,
subject = "ID",
data = data_hlme,
ng = 2,
mixture = ~ Time,
B = m1$raw
)
}
#> $method
#> [1] "lcmm::lcmm"
#>
#> $raw
#> General latent class mixed model
#> fitted by maximum likelihood method
#>
#> lcmm::lcmm(fixed = fixed, mixture = ..1, random = random, subject = subject,
#> ng = ng, data = data)
#>
#> Statistical Model:
#> Dataset: data
#> Number of subjects: 100
#> Number of observations: 326
#> Number of latent classes: 2
#> Number of parameters: 9
#> Link function: linear
#>
#> Iteration process:
#> Convergence criteria satisfied
#> Number of iterations: 18
#> Number of iterations: 18
#> Convergence criteria: parameters= 1.7e-07
#> : likelihood= 7.2e-08
#> : second derivatives= 6.3e-15
#>
#> Goodness-of-fit statistics:
#> maximum log-likelihood: -793.83
#> AIC: 1605.67
#> BIC: 1629.11
#>
#>
#>
# }
