| gridsearch {lcmm} | R Documentation |
Automatic grid search
Description
This function provides an automatic grid search for latent class mixed
models estimated with hlme, lcmm, multlcmm and
Jointlcmm functions.
Usage
gridsearch(m, rep, maxiter, minit, cl = NULL)
Arguments
m |
a call of |
rep |
the number of departures from random initial values |
maxiter |
the number of iterations in the optimization algorithm |
minit |
an object of class |
cl |
a cluster created by makeCluster from package parallel or an integer specifying the number of cores to use for parallel computation |
Details
The function permits the estimation of a model from a grid of random initial values to reduce the odds of a convergence towards a local maximum.
The function was inspired by the emEM technique described in Biernacki et al. (2003). It consists in:
1. randomly generating rep sets of initial values for m from
the estimates of minit (this is done internally using option
B=random(minit) rep times)
2. running the optimization algorithm for the model specified in m
from the rep sets of initial values with a maximum number of
iterations of maxit each time.
3. retaining the estimates of the random initialization that provides the
best log-likelihood after maxiter iterations.
4. running the optimization algorithm from these estimates for the final estimation.
Value
an object of class hlme, lcmm, multlcmm,
Jointlcmm or mpjlcmm corresponding to the call specified in m.
Author(s)
Cecile Proust-Lima and Viviane Philipps
References
Biernacki C, Celeux G, Govaert G (2003). Choosing Starting Values for the EM Algorithm for Getting the Highest Likelihood in Multivariate Gaussian Mixture models. Computational Statistics and Data Analysis, 41(3-4), 561-575.
Examples
## Not run:
# initial model with ng=1 for the random initial values
m1 <- hlme(Y ~ Time * X1, random =~ Time, subject = 'ID', ng = 1,
data = data_hlme)
# gridsearch with 10 iterations from 50 random departures
m2d <- gridsearch(rep = 50, maxiter = 10, minit = m1, hlme(Y ~ Time * X1,
mixture =~ Time, random =~ Time, classmb =~ X2 + X3, subject = 'ID',
ng = 2, data = data_hlme))
## End(Not run)