best_model_by_treatment: Identify the Best Model for Each Treatment

View source: R/best_model_by_treatment.R

best_model_by_treatmentR Documentation

Identify the Best Model for Each Treatment

Description

Returns the top-ranked model within each treatment.

Usage

best_model_by_treatment(ranked_comparison)

Arguments

ranked_comparison

Output from rank_models_by_treatment().

Details

Rankings are obtained from rank_models_by_treatment() and are based on model performance metrics such as:

  • R-squared (R²)

  • Root Mean Squared Error (RMSE)

  • Residual Sum of Squares (RSS)

  • Akaike Information Criterion (AIC)

  • Bayesian Information Criterion (BIC)

This function provides a concise summary of the best-performing model for each treatment and is useful for identifying whether different treatments are best described by different kinetic models.

Value

A data frame containing the highest-ranked model for each treatment.

See Also

compare_models_by_treatment, rank_models_by_treatment, model_win_frequency, compare_models

Examples


files <- example_data()

raw_data <- read_ankom(
  files$ankom
)

metadata <- read_metadata(
  files$metadata
)

gp <- process_ankom(
  raw_data,
  metadata,
  headspace_ml = 210,
  temperature_c = 39
)

groot_fit <- fit_groot(
  gp
)

gompertz_fit <- fit_gompertz(
  gp
)

comparison <- compare_models_by_treatment(
  Groot = groot_fit,
  Gompertz = gompertz_fit
)

ranking <- rank_models_by_treatment(
  comparison
)

best_model_by_treatment(
  ranking
)


rumenGP documentation built on Oct. 2, 2026, 5:09 p.m.