Define an internal metric for lcModels

defineInternalMetric(
  name,
  fun,
  warnIfExists = getOption("latrend.warnMetricOverride", TRUE)
)

Arguments

name

The name of the metric.

fun

The function to compute the metric, accepting a lcModel object as input.

warnIfExists

Whether to output a warning when the metric is already defined.

Examples

defineInternalMetric("BIC", fun = BIC)
#> Warning: ovewriting existing metric definition for BIC

mae <- function(object) {
  mean(abs(residuals(object)))
}
defineInternalMetric("MAE", fun = mae)
#> Warning: ovewriting existing metric definition for MAE