Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

permut

Permutation of the latent classes


Description

This function allows a re-ordering of the latent classes of an estimated model.

Usage

permut(m, order, estim = TRUE)

Arguments

m

an object inheriting from classes hlme, lcmm, multlcmm or Jointlcmm

order

a vector (integer between 1 and ng) containing the new order of the latent classes

estim

optional boolean specifying if the model should estimated with the reordered parameters as initial values. By default, the model is estimated. If FALSE, only the coefficients in $best are modified. All other outputs are not changed.

Value

An object of the same class as m, with reordered classes, or the initial object with new coefficients if estim is FALSE.

Author(s)

Viviane Philipps and Cecile Proust-Lima

Examples

## Estimation of a hlme model with 2 classes
m2 <- hlme(Y~Time*X1,mixture=~Time,random=~Time,classmb=~X2+X3,subject='ID',
         ng=2,data=data_hlme,B=c(0.11,-0.74,-0.07,20.71,
                                 29.39,-1,0.13,2.45,-0.29,4.5,0.36,0.79,0.97))

## Exchange class 2 and class 1
m2b <- permut(m2,order=c(2,1))

lcmm

Extended Mixed Models Using Latent Classes and Latent Processes

v1.9.2
GPL (>= 2.0)
Authors
Cecile Proust-Lima, Viviane Philipps, Amadou Diakite and Benoit Liquet
Initial release
2020-07-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.