Learn R Programming

flexFitR (version 1.2.2)

performance: Compare performance of different models

Description

Computes indices of model performance for different models at once and hence allows comparison of indices across models.

Usage

performance(..., metrics = "all", metadata = FALSE, digits = 2)

Value

A data.frame with performance metrics for models in (...).

Arguments

...

Multiple model objects (only of class `modeler`).

metrics

Can be "all" or a character vector of metrics to be computed (one or more of "logLik", "AIC", "AICc", "BIC", "Sigma", "SSE", "MAE", "MSE", "RMSE", "R2"). "all" by default.

metadata

Logical. If TRUE, metadata is included with the performance metrics. Default is FALSE.

digits

An integer. The number of decimal places to round the output. Default is 2.

Examples

Run this code
library(flexFitR)
data(dt_potato)
# Model 1
mod_1 <- dt_potato |>
  modeler(
    x = DAP,
    y = Canopy,
    grp = Plot,
    fn = "fn_lin_plat",
    parameters = c(t1 = 45, t2 = 80, k = 90),
    subset = 40
  )
print(mod_1)
# Model 2
mod_2 <- dt_potato |>
  modeler(
    x = DAP,
    y = Canopy,
    grp = Plot,
    fn = "fn_logistic",
    parameters = c(a = 0.199, t0 = 47.7, k = 100),
    subset = 40
  )
print(mod_2)
# Model 3
mod_3 <- dt_potato |>
  modeler(
    x = DAP,
    y = Canopy,
    grp = Plot,
    fn = "fn_lin",
    parameters = c(m = 20, b = 2),
    subset = 40
  )
print(mod_3)
performance(mod_1, mod_2, mod_3, metrics = c("AIC", "AICc", "BIC", "Sigma"))

Run the code above in your browser using DataLab