Description of lcmm package

 

Functionalities of the package

The R package lcmm provides a series of functions to estimate statistical models based on the linear mixed model theory. It includes the estimation of:

The package lcmm includes 4 main functions: lcmm, hlme, multlcmm and Jointlcmm. Each function is described in a different vignette. These functions apply to longitudinal markers, even those that have limited metrological properties but the functions can also be used in cross-sectional context.

For each model, maximum likelihood estimators are obtained using a modified Marquardt algorithm with strict convergence criteria based on the parameters and likelihood stability, and on the negativity of the second derivatives. The package also provides various post-fit functions including goodness-of-fit analyses, classification, plots, predicted trajectories, individual dynamic prediction of the event and predictive accuracy assessment.

Calls functions

Each function is precisely introduced in the companion paper (Proust-Lima, JSS 2017 - https://doi.org/10.18637/jss.v078.i02).

hlme

This function is used for standard linear mixed models and their extension to multiple profiles of trajectory : the latent class linear mixed models

lcmm

This function is used to estimate mixed models when the outcome does not have a Gaussian distribution. The method is called “latent process model”. As hlme, the method also handles heterogeneous profiles of trajectories in a “latent process and latent class mixed model”.

lcmm(fixed, mixture, random, subject, classmb, ng = 1, idiag = FALSE, nwg = FALSE, link = "linear", intnodes = NULL, epsY = 0.5, cor = NULL, data, B, convB = 1e-04, convL = 1e-04, convG = 1e-04,  maxiter = 100, nsim = 100, prior, range = NULL, subset = NULL, na.action = 1, posfix = NULL,  partialH = FALSE)

multlcmm

This function extends lcmm function when more than one marker measures the same underlying construct of interest. Again the function handles either homogeneous or heterogeneous profiles of trajectories.

multlcmm(fixed, mixture, random, subject, classmb, ng = 1, idiag = FALSE, nwg = FALSE, randomY = FALSE, link = "linear", intnodes = NULL, epsY = 0.5, cor = NULL, data, B, convB = 1e-04, convL = 1e-04, convG = 1e-04, maxiter = 100, nsim = 100, prior, range = NULL, subset = NULL, na.action = 1, posfix = NULL, partialH = FALSE)

Jointlcmm

This function extends hlme, lcmm and multlcmm to jointly analyze times to event (in a competing setting). The latent structure shared between the longitudinal outcome(s) and the time(s) to event is latent classes.

Jointlcmm(fixed, mixture, random, subject, classmb, ng = 1, idiag = FALSE, nwg = FALSE, survival, hazard = "Weibull", hazardtype = "Specific", hazardnodes = NULL, TimeDepVar = NULL, link = NULL, intnodes = NULL, epsY = 0.5, range = NULL, cor = NULL, data, B, convB = 1e-4, convL = 1e-4, convG = 1e-4, maxiter = 100, nsim = 100, prior, logscale = FALSE, subset = NULL, na.action = 1, posfix = NULL, partialH = FALSE)

Package installation

If the package lcmm is not installed, install it:

install.packages("lcmm")

Each time you will open a R session, you will first have to load the lcmm library:

library(lcmm)

Dataset example

paquid subsample

In the wikis, lcmm is illutrated with paquid dataset. This is a subsample of 500 subjects from the original French prospective study Paquid. This dataset can not be used for epidemiological purposes as the subsample is not representative of the original cohort (in particular, dementia cases have been over sampled).

The data are in the longitudinal format including some variables such as 3 psychometric tests \(MMSE\), \(BVRT\), \(IST\), the depressive symptomatology scale \(CESD\) and the variables \(age\), \(agedem\) (age until dementia), \(dem\) (boolean with 1 for dementia), \(ageinit\), \(CEP\) (education level) and \(male\).

 

For visualizing the data (head of the table only):

 

The different markers are collected at different times. In the dataset the timescale is \(age\).

 

For obtaining a quick summary of the data:

 

Some variables have missing values. This is not a problem when using lcmm package as missing values are systematically removed.

 

MMSE outcome

In the lcmm examples, MMSE is usually considered as the outcome. MMSE is a very common neuropsychological test to measure global cognitive functioning in the elderly. It has a very asymmetric distribution so that it is usually normalized to be applied with methods for Gaussian variables. This is done using a pre-normalization function dedicated to MMSE provided in NormPsy package:

 

 

The individual repeated measures of MMSE to be modelled are: