Skip to contents

compare_models() combines the output of fit_metrics() for two or more fitted models. It is useful when choosing between alternative primary growth, inactivation, or cardinal models fitted to the same response scale.

Usage

compare_models(..., sort_by = c("AIC", "BIC", "RMSE", "MAE", "none"))

Arguments

...

predmicror_fit objects, or a single list of predmicror_fit objects.

sort_by

Character string. One of "AIC", "BIC", "RMSE", "MAE", or "none".

Value

A data frame with one row per fitted model.

Examples

data(growthfull)
huang <- fit_growth(
  growthfull,
  model = "HuangFM",
  time = "Time",
  response = "lnN",
  start = list(Y0 = 0, Ymax = 22, MUmax = 1.7, lag = 5)
)
baranyi <- fit_growth(
  growthfull,
  model = "BaranyiFM",
  time = "Time",
  response = "lnN",
  start = list(Y0 = 0, Ymax = 22, MUmax = 1.7, lag = 5)
)
compare_models(huang = huang, baranyi = baranyi)
#>       fit     model   type response response_scale  n p      SSE      RMSE
#> 1   huang   HuangFM growth      lnN            lnN 13 4 1.777041 0.3697235
#> 2 baranyi BaranyiFM growth      lnN            lnN 13 4 1.842461 0.3764675
#>         MAE         bias       RSE        R2    adj_R2    logLik      AIC
#> 1 0.3379108 3.909757e-09 0.4443523 0.9982255 0.9973382 -5.511202 21.02240
#> 2 0.3414180 2.170706e-07 0.4524576 0.9981602 0.9972403 -5.746195 21.49239
#>        BIC converged
#> 1 23.84715      TRUE
#> 2 24.31714      TRUE