LCTMcompare: A model comparison toolkit. 'LCTMcompare'

View source: R/LCTMcompare.R

LCTMcompareR Documentation

A model comparison toolkit. LCTMcompare

Description

The function LCTMcompare gives a summary of comparison between fitted LCTM models.

Usage

LCTMcompare(modelA, modelB)

Arguments

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

Value

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$),

References

https://bmjopen.bmj.com/content/8/7/e020683

Examples

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)

hlennon/LCTMtools documentation built on Dec. 6, 2022, 3:04 a.m.