Growth mixture modeling through latent-class linear mixed modeling.

lcMethodLcmmGMM(
  fixed,
  mixture = ~1,
  random = ~1,
  classmb = ~1,
  time = getOption("latrend.time"),
  id = getOption("latrend.id"),
  init = "lme",
  nClusters = 2,
  ...
)

Arguments

fixed

The fixed effects formula.

mixture

The mixture-specific effects formula. See lcmm::hlme for details.

random

The random effects formula. See lcmm::hlme for details.

classmb

The cluster membership formula for the multinomial logistic model. See lcmm::hlme for details.

time

The name of the time variable.

id

The name of the trajectory identifier variable. This replaces the subject argument of lcmm::hlme.

init

Alternative for the B argument of lcmm::hlme, for initializing the hlme fitting procedure. This is only applicable for nClusters > 1. Options:

  • "lme.random" (default): random initialization through a standard linear mixed model. Assigns a fitted standard linear mixed model enclosed in a call to random() to the B argument.

  • "lme", fits a standard linear mixed model and passes this to the B argument.

  • "gridsearch", a gridsearch is used with initialization from "lme.random", following the approach used by lcmm::gridsearch. To use this initalization, specify arguments gridsearch.maxiter (max number of iterations during search), gridsearch.rep (number of fits during search), and gridsearch.parallel (whether to enable parallel computation).

  • NULL or "default", the default lcmm::hlme input for B is used.

The argument is ignored if the B argument is specified, or nClusters = 1.

nClusters

The number of clusters to fit. This replaces the ng argument of lcmm::hlme.

...

Arguments passed to lcmm::hlme. The following arguments are ignored: data, fixed, random, mixture, subject, classmb, returndata, ng, verbose, subset.

References

proustlima2017estimationlatrend

proustlima2019lcmmlatrend

Examples

data(latrendData)

if (rlang::is_installed("lcmm")) {
  method <- lcMethodLcmmGMM(
    fixed = Y ~ Time,
    mixture = ~ Time,
    random = ~ 1,
    id = "Id",
    time = "Time",
    nClusters = 2
  )
  gmm <- latrend(method, data = latrendData)
  summary(gmm)

  # define method with gridsearch
  method <- lcMethodLcmmGMM(
    fixed = Y ~ Time,
    mixture = ~ Time,
    random = ~ 1,
    id = "Id",
    time = "Time",
    nClusters = 3,
    init = "gridsearch",
    gridsearch.maxiter = 10,
    gridsearch.rep = 50,
    gridsearch.parallel = TRUE
  )
}