logLik.lcModel: Extract the log-likelihood of a lcModel

View source: R/model-evaluation.R

logLik.lcModelR Documentation

Extract the log-likelihood of a lcModel

Description

Extract the log-likelihood of a lcModel

Usage

## S3 method for class 'lcModel'
logLik(object, ...)

Arguments

object

The lcModel object.

...

Additional arguments.

Details

The default implementation checks for the existence of the logLik() function for the internal model, and returns the output, if available.

Value

A numeric with the computed log-likelihood. If unavailable, NA is returned.

See Also

stats::logLik metric

Examples

data(latrendData)

if (rlang::is_installed("lcmm")) {
  method <- lcMethodLcmmGBTM(
    fixed = Y ~ Time,
    mixture = ~ 1,
    id = "Id",
    time = "Time",
    nClusters = 3
  )
  gbtm <- latrend(method, data = latrendData)
  logLik(gbtm)
}

latrend documentation built on March 31, 2023, 5:45 p.m.