| LCTMcompare | R Documentation |
LCTMcompareThe function LCTMcompare gives a summary of comparison between fitted LCTM models.
LCTMcompare(modelA, modelB)
modelA |
is the output from hlme() R model or model is the output of SASmodelbuilder(oe, os, op, of) passed through it |
modelB |
the model to be compared which is the output from hlme() R model or model is the output of SASmodelbuilder(oe, os, op, of) passed through it |
A selection of model adequacy tests, including the APPA (average posterior probability of assignment), the OCC (odds of correct classification), entropy $E$, Relative entropy ($E_k$),
https://bmjopen.bmj.com/content/8/7/e020683
data(bmi_long, package='LCTMtools')
require(lcmm)
set.seed(999)
data(bmi_long, package = 'LCTMtools' )
# Use the hlme function from the 'lcmm' R package to fit a 2 class latent class trajectory model
model2classes <- lcmm::hlme(fixed = bmi ~ age + I(age^2),
mixture= ~ age,
random = ~ age,
ng = 2,
nwg = TRUE,
subject = "id",
data = data.frame(bmi_long[1:500, ] ))
# Compute model adequacy measures
LCTMtoolkit(model2classes)
# Compare with a 3 class model
model3classes <- lcmm::hlme(fixed = bmi ~ age + I(age^2),
mixture= ~ age,
random = ~ age,
ng = 3,
nwg = TRUE,
subject = "id",
data = data.frame(bmi_long[1:500, ] ))
LCTMtoolkit(model3classes)
LCTMcompare(model2classes, model3classes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.