plot_residuals: Plot Model Residuals

View source: R/plot_residuals.R

plot_residualsR Documentation

Plot Model Residuals

Description

Plots residuals for an individual bottle.

Usage

plot_residuals(fit, head = NULL)

Arguments

fit

A fitted model object containing a predictions element.

head

Optional Head identifier. If omitted and only one bottle is present, that bottle is plotted automatically.

Details

Residuals are calculated as:

Residual = Observed - Predicted

Residual plots are useful for:

  • Identifying systematic model bias

  • Detecting outliers

  • Evaluating model assumptions

  • Assessing goodness of fit

Ideally, residuals should be randomly distributed around zero with no obvious trend through time.

Value

A ggplot2 object.

See Also

plot_fit, plot_residual_comparison, plot_diagnostics, fit_groot

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
)

fit <- fit_groot(
  gp
)

plot_residuals(
  fit,
  head = 1
)


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