| Title: | Rumen Gas Production Modeling, Comparison, and Visualization |
|---|---|
| Description: | Provides tools for importing, processing, visualizing, fitting, comparing, and interpreting in vitro rumen gas production data. Supports ANKOM RF workflows, generic gas production datasets, and pressure-based measurements. Includes multiple kinetic models, custom nonlinear models, model comparison workflows, treatment-level ranking, diagnostic tools, and visualization functions for rumen fermentation studies. |
| Authors: | Arlan Araujo Rodrigues [aut, cre], Hilario Cuquetto Mantovani [aut] |
| Maintainer: | Arlan Araujo Rodrigues <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.2.1 |
| Built: | 2026-10-12 23:26:31 UTC |
| Source: | https://github.com/araujorodrig-lab/rumengp |
Converts gas production data from any source into the internal rumenGP format.
as_rumen_gp( data, head_col, time_col, gas_col = NULL, pressure_col = NULL, treatment_col = NULL, bottle_col = NULL, rep_col = NULL, pressure_unit = c("psi", "kpa"), headspace_volume = NULL, headspace_unit = c("mL", "L"), temperature = 39, zero_negative_pressure = FALSE )as_rumen_gp( data, head_col, time_col, gas_col = NULL, pressure_col = NULL, treatment_col = NULL, bottle_col = NULL, rep_col = NULL, pressure_unit = c("psi", "kpa"), headspace_volume = NULL, headspace_unit = c("mL", "L"), temperature = 39, zero_negative_pressure = FALSE )
data |
A data frame. |
head_col |
Column identifying bottles. |
time_col |
Column containing incubation time. |
gas_col |
Optional column containing cumulative gas production (mL). |
pressure_col |
Optional column containing pressure measurements. |
treatment_col |
Optional treatment column. |
bottle_col |
Optional bottle column. |
rep_col |
Optional replicate column. |
pressure_unit |
Pressure unit. Either "psi" or "kpa". |
headspace_volume |
Headspace volume. Required when pressure_col is supplied. |
headspace_unit |
Headspace unit. Either "mL" or "L". |
temperature |
Incubation temperature in degC. |
zero_negative_pressure |
Logical. If TRUE, negative pressure values are converted to zero before gas-volume calculations. |
The function accepts either cumulative gas volume or gas pressure measurements.
When pressure is supplied, gas volume is estimated using the same conversion used by process_ankom().
A rumen_gp object.
# ---------------------------- # Example 1: Gas volume data # ---------------------------- manual_volume <- data.frame( Bottle = c( 1, 1, 1, 2, 2, 2 ), Treatment = c( "Control", "Control", "Control", "Corn", "Corn", "Corn" ), Time = c( 0, 4, 8, 0, 4, 8 ), Gas = c( 0, 20, 40, 0, 35, 60 ) ) gp <- as_rumen_gp( data = manual_volume, head_col = "Bottle", treatment_col = "Treatment", time_col = "Time", gas_col = "Gas" ) head(gp) # ---------------------------- # Example 2: Pressure data # ---------------------------- manual_pressure <- data.frame( Bottle = rep( 1, 10 ), Time = c( 0, 2, 4, 6, 8, 12, 16, 24, 36, 48 ), PSI = c( 0, 0.2, 0.5, 0.8, 1.2, 1.8, 2.5, 3.2, 4.0, 4.5 ) ) gp <- as_rumen_gp( data = manual_pressure, head_col = "Bottle", time_col = "Time", pressure_col = "PSI", pressure_unit = "psi", headspace_volume = 60 ) head(gp) # Example model fit fit <- fit_groot(gp) summary(fit)# ---------------------------- # Example 1: Gas volume data # ---------------------------- manual_volume <- data.frame( Bottle = c( 1, 1, 1, 2, 2, 2 ), Treatment = c( "Control", "Control", "Control", "Corn", "Corn", "Corn" ), Time = c( 0, 4, 8, 0, 4, 8 ), Gas = c( 0, 20, 40, 0, 35, 60 ) ) gp <- as_rumen_gp( data = manual_volume, head_col = "Bottle", treatment_col = "Treatment", time_col = "Time", gas_col = "Gas" ) head(gp) # ---------------------------- # Example 2: Pressure data # ---------------------------- manual_pressure <- data.frame( Bottle = rep( 1, 10 ), Time = c( 0, 2, 4, 6, 8, 12, 16, 24, 36, 48 ), PSI = c( 0, 0.2, 0.5, 0.8, 1.2, 1.8, 2.5, 3.2, 4.0, 4.5 ) ) gp <- as_rumen_gp( data = manual_pressure, head_col = "Bottle", time_col = "Time", pressure_col = "PSI", pressure_unit = "psi", headspace_volume = 60 ) head(gp) # Example model fit fit <- fit_groot(gp) summary(fit)
Returns the top-ranked model within each treatment.
best_model_by_treatment(ranked_comparison)best_model_by_treatment(ranked_comparison)
ranked_comparison |
Output from
|
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.
A data frame containing the highest-ranked model for each treatment.
compare_models_by_treatment,
rank_models_by_treatment,
model_win_frequency,
compare_models
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 )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 )
Compares performance metrics across multiple fitted kinetic models.
compare_models(...)compare_models(...)
... |
Named fitted model objects. |
Model comparison metrics typically include:
R-squared (R²)
Root Mean Squared Error (RMSE)
Residual Sum of Squares (RSS)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
This function helps researchers identify models that provide the best balance between goodness of fit and model complexity.
The resulting comparison table can be used with:
rank_models()
plot_model_performance()
plot_model_rankings()
A data frame summarizing model performance metrics for each fitted model.
rank_models,
compare_models_by_treatment,
plot_model_performance,
plot_model_rankings
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( Groot = groot_fit, Gompertz = gompertz_fit ) comparisonfiles <- 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( Groot = groot_fit, Gompertz = gompertz_fit ) comparison
Calculates model performance separately for each treatment.
compare_models_by_treatment(...)compare_models_by_treatment(...)
... |
Fitted model objects. |
Performance metrics are computed using treatment-level predictions and observations, allowing direct comparison of competing models within each treatment.
Typical metrics include:
R-squared (R²)
Root Mean Squared Error (RMSE)
Residual Sum of Squares (RSS)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
This function is useful for determining whether different treatments are best described by different kinetic models.
A data frame containing treatment-level performance metrics for each fitted model.
compare_models,
rank_models_by_treatment,
best_model_by_treatment,
model_win_frequency
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 ) compare_models_by_treatment( Groot = groot_fit, Gompertz = gompertz_fit )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 ) compare_models_by_treatment( Groot = groot_fit, Gompertz = gompertz_fit )
Returns paths to example files included with the package.
example_data()example_data()
The example dataset can be used to explore package functionality, reproduce examples, and learn rumenGP workflows without requiring external files.
The returned object includes:
Example ANKOM RF data
Example metadata
These files are used throughout the package documentation, examples, and vignettes.
A named list containing file paths to package example data.
read_ankom,
read_metadata,
process_ankom,
fit_groot
files <- example_data() files raw_data <- read_ankom( files$ankom ) metadata <- read_metadata( files$metadata ) gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39 ) head( gp ) fit <- fit_groot( gp ) summary( fit )files <- example_data() files raw_data <- read_ankom( files$ankom ) metadata <- read_metadata( files$metadata ) gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39 ) head( gp ) fit <- fit_groot( gp ) summary( fit )
Removes one or more bottles from a
rumen_gp object while recording
exclusion information.
exclude_heads(data, heads, reason = NULL)exclude_heads(data, heads, reason = NULL)
data |
A |
heads |
Character vector of bottle identifiers to remove. |
reason |
Character vector containing the reason for each exclusion. |
This function is useful for excluding:
Leaking bottles
Sensor failures
Damaged bottles
Biologically implausible observations
Other quality-control issues
Exclusion information is retained to support transparent reporting and reproducible analyses.
A filtered rumen_gp object.
validate_ankom,
flag_model,
process_ankom
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 ) gp_filtered <- exclude_heads( data = gp, heads = c( "12", "18" ), reason = c( "Bottle leak", "Sensor malfunction" ) ) gp_filteredfiles <- 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 ) gp_filtered <- exclude_heads( data = gp, heads = c( "12", "18" ), reason = c( "Bottle leak", "Sensor malfunction" ) ) gp_filtered
Fits the Brody gas production model to each bottle in a rumen_gp dataset.
fit_brody(data, start = NULL)fit_brody(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is an integration constant
is the fractional rate constant
The Brody model describes gas production as a
monotonic increase toward an asymptotic value.
The parameter controls the speed of
fermentation, while controls the initial
position of the curve.
Simple and robust
Stable convergence
Easy biological interpretation
Useful as a baseline model
No explicit lag parameter
Less flexible than sigmoidal models
May not adequately represent strongly sigmoidal fermentation profiles
A brody_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_brody( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_brody( gp, start = list( A = 120, b = 0.9, k = 0.05 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_brody( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_brody( gp, start = list( A = 120, b = 0.9, k = 0.05 ) ) summary(fit_custom_start)
Fits the Burr XII gas production model to each bottle in a rumen_gp dataset.
fit_burr_xii(data, start = NULL)fit_burr_xii(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the rate parameter
is the first shape parameter
is the second shape parameter
The Burr XII model is a highly flexible sigmoidal model capable of describing a wide range of gas production profiles.
The parameter controls the speed
of gas production, while and
jointly control curve shape,
asymmetry, and inflection behavior.
Excellent flexibility
Accommodates diverse curve shapes
Often produces excellent fits
Identified as one of the top-performing models in a large comparative study of in vitro gas production profiles
Requires positive incubation times
Additional parameters increase model complexity
Greater risk of overfitting than simpler models
A burr_xii_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_burr_xii( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_burr_xii( gp, start = list( VF = 120, r = 0.10, a = 2, p = 1 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_burr_xii( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_burr_xii( gp, start = list( VF = 120, r = 0.10, a = 2, p = 1 ) ) summary(fit_custom_start)
Fits a user-defined nonlinear model to each bottle in a rumen_gp dataset.
fit_custom( data, formula, start, lower = NULL, upper = NULL, model_name = "Custom" )fit_custom( data, formula, start, lower = NULL, upper = NULL, model_name = "Custom" )
data |
A rumen_gp object. |
formula |
A nonlinear model formula. |
start |
Named list of starting values. |
lower |
Optional named numeric vector of lower parameter bounds. |
upper |
Optional named numeric vector of upper parameter bounds. |
model_name |
Character string used to label the fitted model. |
This function allows researchers to fit
custom nonlinear kinetic equations using
minpack.lm::nlsLM().
Custom models integrate directly with:
summary()
plot_fit()
plot_residuals()
compare_models()
making them fully compatible with the rumenGP modeling framework.
The model formula must:
Use Gas_mL as the response variable
Use Time_h as the time variable
Include all parameters listed in
start
Example:
Gas_mL ~
A *
(
Time_h /
(
Time_h + K
)
)
Starting values are supplied through
start.
Example:
start = list( A = 150, K = 10 )
Good starting values often improve convergence and reduce fitting failures.
Optional lower and upper bounds may be supplied.
Example:
lower = c( A = 0, K = 0 ) upper = c( A = 500, K = 100 )
Bounds can improve stability and prevent biologically unrealistic parameter estimates.
Start with biologically meaningful equations
Use reasonable starting values
Apply parameter bounds when appropriate
Compare custom models against built-in models
Evaluate both fit quality and parameter interpretability
A custom_fit object containing:
Model name
Formula
Starting values
Parameter bounds
Parameter estimates
Model diagnostics
Predicted values
Residuals
fit_groot,
fit_mm,
compare_models,
plot_fit,
plot_residuals
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 ) # Hyperbolic model custom_fit <- fit_custom( data = gp, formula = Gas_mL ~ A * ( Time_h / ( Time_h + K ) ), start = list( A = 150, K = 10 ), lower = c( A = 0, K = 0 ), model_name = "Hyperbolic" ) summary(custom_fit) plot_fit( custom_fit, head = 1 ) plot_residuals( custom_fit, head = 1 ) # Compare with built-in models compare_models( Groot = fit_groot(gp), Hyperbolic = custom_fit )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 ) # Hyperbolic model custom_fit <- fit_custom( data = gp, formula = Gas_mL ~ A * ( Time_h / ( Time_h + K ) ), start = list( A = 150, K = 10 ), lower = c( A = 0, K = 0 ), model_name = "Hyperbolic" ) summary(custom_fit) plot_fit( custom_fit, head = 1 ) plot_residuals( custom_fit, head = 1 ) # Compare with built-in models compare_models( Groot = fit_groot(gp), Hyperbolic = custom_fit )
Fits a dual-pool logistic model representing rapidly and slowly degradable fractions.
fit_dual_logistic(data, start = NULL)fit_dual_logistic(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is the final gas volume from the rapidly fermentable fraction
is the final gas volume from the slowly fermentable fraction
is the fractional rate constant of the rapid fraction
is the fractional rate constant of the slow fraction
is lag time
The Dual Logistic model assumes that gas production originates from two independent fermentation pools:
A rapidly degradable fraction ()
A slowly degradable fraction ()
Each fraction follows a logistic fermentation pattern with its own rate constant.
Represents complex fermentation dynamics
Separates rapid and slow fermentation pools
Biologically meaningful parameterization
Useful for heterogeneous substrates
Requires estimation of five parameters
More computationally demanding
Greater risk of parameter correlation
May require careful starting values
A dual_logistic_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
Rapid and slow pool estimates
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 using package default starting values fit_default <- fit_dual_logistic( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_dual_logistic( gp, start = list( V1F = 30, V2F = 70, k1 = 0.20, k2 = 0.05, lambda = 0.50 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_dual_logistic( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_dual_logistic( gp, start = list( V1F = 30, V2F = 70, k1 = 0.20, k2 = 0.05, lambda = 0.50 ) ) summary(fit_custom_start)
Fits the exponential gas production model without an explicit lag phase.
fit_exp0(data, start = NULL)fit_exp0(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the fractional rate constant
The EXP0 model assumes that gas production increases exponentially toward an asymptotic value without an explicit lag phase.
Simple and computationally efficient
Stable convergence
Easy biological interpretation
Does not model lag time
Limited flexibility for sigmoidal fermentation profiles
An exp0_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package defaults fit_default <- fit_exp0( gp ) summary(fit_default) # Fit using user-defined starting values fit_custom_start <- fit_exp0( gp, start = list( Vf = 120, k = 0.05 ) ) summary(fit_custom_start)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 using package defaults fit_default <- fit_exp0( gp ) summary(fit_default) # Fit using user-defined starting values fit_custom_start <- fit_exp0( gp, start = list( Vf = 120, k = 0.05 ) ) summary(fit_custom_start)
Fits the exponential gas production model with an explicit lag phase.
fit_expl(data, start = NULL)fit_expl(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the fractional rate constant
is lag time
The EXPL model assumes that gas production follows an exponential pattern after a lag phase. The lag parameter represents the delay before substantial fermentation begins.
Explicit lag parameter
Simple biological interpretation
Stable convergence
Less flexible than sigmoidal models
May not adequately represent multiple fermentation phases
An expl_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_expl( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_expl( gp, start = list( Vf = 120, k = 0.05, lambda = 1 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_expl( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_expl( gp, start = list( Vf = 120, k = 0.05, lambda = 1 ) ) summary(fit_custom_start)
Fits the Zwietering-modified Gompertz model to each bottle in a rumen_gp dataset.
fit_gompertz(data, start = NULL)fit_gompertz(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the maximum gas production rate
is lag time
is Euler's number
The modified Gompertz model is one of the most commonly used models for gas production kinetics.
It explicitly estimates:
Final gas production potential ()
Maximum gas production rate ()
Lag time ()
making it biologically informative and easy to interpret.
Explicit lag parameter
Explicit maximum gas production rate
Excellent flexibility
Widely used in gas production studies
Strong biological interpretation
More computationally demanding than simple exponential models
Parameters may exhibit correlation in some datasets
A gompertz_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_gompertz( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_gompertz( gp, start = list( A = 120, mu = 5, lambda = 1 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_gompertz( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_gompertz( gp, start = list( A = 120, mu = 5, lambda = 1 ) ) summary(fit_custom_start)
Fits the Groot gas production model to each bottle in a rumen_gp dataset.
fit_groot(data, start = NULL)fit_groot(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the half-time parameter
is the shape parameter
The Groot model is a flexible sigmoidal model widely used in rumen gas production studies.
The parameter represents the time required
to reach approximately half of the asymptotic gas
production, while controls curve shape and
steepness.
Excellent flexibility
Biologically interpretable parameters
Often produces excellent fits
Widely used in rumen fermentation studies
Requires positive incubation times
Shape parameter may be less intuitive than simple exponential models
The Groot model is mathematically equivalent to the
generalized Michaelis-Menten model implemented in
fit_mm().
Parameter correspondence:
VF = A
b = K
k = c
Both formulations produce identical fitted values, residuals, diagnostics, AIC, BIC, RMSE, and R-squared when convergence is achieved.
Researchers may choose either formulation according to the terminology commonly used in their field.
A groot_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_groot( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_groot( gp, start = list( VF = 120, b = 10, k = 2 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_groot( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_groot( gp, start = list( VF = 120, b = 10, k = 2 ) ) summary(fit_custom_start)
Fits the Inverse Paralogistic gas production model to each bottle in a rumen_gp dataset.
fit_inverse_paralogistic(data, start = NULL)fit_inverse_paralogistic(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the rate parameter
is the shape parameter
The Inverse Paralogistic model is a flexible sigmoidal model capable of describing a wide range of gas production profiles.
The parameter controls the speed of
gas production, while controls curve
shape, steepness, and inflection behavior.
Excellent flexibility
Biologically interpretable parameters
Often produces excellent fits
Identified as one of the top-performing models in a large comparative study of in vitro gas production profiles
Requires positive incubation times
Shape parameter may be less intuitive than simple exponential models
Meaningful inflection-point interpretation
generally requires
A inverse_paralogistic_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_inverse_paralogistic( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_inverse_paralogistic( gp, start = list( VF = 120, r = 0.10, a = 2 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_inverse_paralogistic( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_inverse_paralogistic( gp, start = list( VF = 120, r = 0.10, a = 2 ) ) summary(fit_custom_start)
Fits the Logistic-Exponential model without an explicit lag phase.
fit_le0(data, start = NULL)fit_le0(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the fractional rate constant
is a shape parameter
The LE0 model combines an exponential fermentation component with a logistic component.
Compared with simple exponential models, LE0 provides additional flexibility in curve shape without requiring an explicit lag parameter.
Flexible sigmoidal behavior
More adaptable than simple exponential models
No lag parameter required
Can accommodate gradual changes in fermentation rate
More complex than EXP0
Shape parameter may be less intuitive biologically
Additional parameter may increase parameter correlation
A le0_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_le0( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_le0( gp, start = list( A = 120, k = 0.05, d = 0.50 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_le0( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_le0( gp, start = list( A = 120, k = 0.05, d = 0.50 ) ) summary(fit_custom_start)
Fits the Logistic-Exponential model with an explicit lag phase.
fit_lel(data, start = NULL)fit_lel(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the fractional rate constant
is a shape parameter
is lag time
The LEL model combines an exponential fermentation component, a logistic component, and an explicit lag phase.
This model is more flexible than traditional exponential models and can describe complex fermentation dynamics with delayed onset of gas production.
Explicit lag parameter
Flexible sigmoidal behavior
Can represent delayed fermentation
Often fits complex gas production profiles well
More parameters than EXP0 or EXPL
Greater risk of parameter correlation
May require careful starting values
Increased computational complexity
A lel_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_lel( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_lel( gp, start = list( A = 120, k = 0.05, d = 0.50, lambda = 1 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_lel( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_lel( gp, start = list( A = 120, k = 0.05, d = 0.50, lambda = 1 ) ) summary(fit_custom_start)
Fits a Logistic gas-production model to each bottle in a rumen_gp dataset.
fit_logistic(data, start = NULL)fit_logistic(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the fractional rate constant
is lag time
The Logistic model describes gas production using a sigmoidal curve with an initial lag phase, a period of rapid fermentation, and a plateau approaching the asymptotic gas production.
The parameter controls the steepness of the
curve, while determines the position
of the sigmoid along the time axis.
Explicit lag parameter
Smooth sigmoidal behavior
Stable convergence
Widely used in biological growth and fermentation studies
Assumes a symmetric sigmoidal curve
May not adequately fit highly asymmetric fermentation profiles
Less flexible than Gompertz or Dual Logistic models
A logistic_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_logistic( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_logistic( gp, start = list( A = 120, k = 0.05, lambda = 1 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_logistic( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_logistic( gp, start = list( A = 120, k = 0.05, lambda = 1 ) ) summary(fit_custom_start)
Fits the Log-logistic gas production model to each bottle in a rumen_gp dataset.
fit_loglogistic(data, start = NULL)fit_loglogistic(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the rate parameter
is the shape parameter
The Log-logistic model is a flexible sigmoidal model capable of describing a wide range of gas production profiles.
The parameter controls the speed of gas
production, while controls curve shape,
steepness, and inflection behavior.
Excellent flexibility
Biologically interpretable parameters
Often produces excellent fits
Common in nonlinear growth and fermentation modeling
Requires positive incubation times
Shape parameter may be less intuitive than simple exponential models
The Log-logistic model is mathematically
equivalent to both the Groot model
implemented in fit_groot() and the
generalized Michaelis-Menten model
implemented in fit_mm().
Parameter correspondence:
VF = A
a = c = k
1/r = K = b
Both formulations produce identical fitted values, residuals, diagnostics, AIC, BIC, RMSE, and R-squared when convergence is achieved.
Researchers may choose either formulation according to the terminology commonly used in their field.
A loglogistic_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_loglogistic( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_loglogistic( gp, start = list( VF = 120, r = 0.10, a = 2 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_loglogistic( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_loglogistic( gp, start = list( VF = 120, r = 0.10, a = 2 ) ) summary(fit_custom_start)
Fits the Mitscherlich gas-production model to each bottle in a rumen_gp dataset.
fit_mitscherlich(data, start = NULL)fit_mitscherlich(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the fractional rate constant
is a diffusion or shape parameter
is lag time
The Mitscherlich model combines an exponential fermentation component with a diffusion-like term.
The parameter describes the primary
fermentation rate, while provides
additional flexibility for representing changes
in fermentation dynamics over time.
Explicit lag parameter
Flexible curve shape
Can describe complex fermentation dynamics
Often performs well when simple exponential models are inadequate
More complex than EXP0 or EXPL
Increased parameter correlation
Diffusion parameter may be less intuitive biologically
May require careful starting values
A mitscherlich_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_mitscherlich( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_mitscherlich( gp, start = list( A = 120, k = 0.05, d = 0.05, lambda = 0.50 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_mitscherlich( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_mitscherlich( gp, start = list( A = 120, k = 0.05, d = 0.05, lambda = 0.50 ) ) summary(fit_custom_start)
Fits the generalized Michaelis-Menten model to each bottle in a rumen_gp dataset.
fit_mm(data, start = NULL)fit_mm(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is asymptotic gas production
is the half-time parameter
is the shape parameter
The generalized Michaelis-Menten model describes cumulative gas production using a flexible sigmoidal function.
The parameter represents the time required
to reach approximately half of the asymptotic gas
production, while controls curve shape and
steepness.
Flexible sigmoidal behavior
Biologically meaningful half-time parameter
Usually converges reliably
Well suited for rumen gas production data
Shape parameter may be difficult to interpret biologically
More complex than simple exponential models
The generalized Michaelis-Menten model is
mathematically equivalent to the Groot model
implemented in fit_groot().
Parameter correspondence:
A = VF
K = b
c = k
Both formulations produce identical fitted values and model diagnostics when convergence is achieved.
Researchers may choose either formulation according to the terminology commonly used in their field.
A mm_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_mm( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_mm( gp, start = list( A = 120, K = 10, c = 2 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_mm( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_mm( gp, start = list( A = 120, K = 10, c = 2 ) ) summary(fit_custom_start)
Fits the Orskov and McDonald gas-production model to each bottle in a rumen_gp dataset.
fit_orskov(data, start = NULL)fit_orskov(data, start = NULL)
data |
A rumen_gp object. |
start |
Optional list of starting values. May contain any of:
|
where:
is cumulative gas production at time
is the intercept (initial gas volume)
is the fermentable fraction
is the fractional rate constant
The Orskov and McDonald model partitions gas production into:
An intercept term ()
A fermentable fraction ()
The asymptotic gas production is:
The parameter controls the rate at which
the asymptote is approached.
Widely used in ruminant nutrition research
Parameters have straightforward biological interpretation
Stable convergence
Useful benchmark model for comparison
No explicit lag parameter
Limited flexibility for highly sigmoidal fermentation profiles
Less adaptable than Gompertz, Groot, or Dual Logistic models
An orskov_fit object containing:
Parameter estimates
Model diagnostics
Predicted values
Residuals
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 using package default starting values fit_default <- fit_orskov( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_orskov( gp, start = list( VF = 5, b = 120, k = 0.05 ) ) summary(fit_custom_start)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 using package default starting values fit_default <- fit_orskov( gp ) summary(fit_default) # Fit using custom starting values fit_custom_start <- fit_orskov( gp, start = list( VF = 5, b = 120, k = 0.05 ) ) summary(fit_custom_start)
Flags bottles with poor convergence, low R-squared values and parameter-boundary issues.
flag_model(fit, r2_threshold = 0.9)flag_model(fit, r2_threshold = 0.9)
fit |
A fitted model object. |
r2_threshold |
Minimum acceptable R-squared. |
Diagnostic table with QC flags.
Summarizes how often each model is the best-performing model across treatments.
model_win_frequency(best_models)model_win_frequency(best_models)
best_models |
Output from
|
Win frequency is calculated from the output of
best_model_by_treatment() and reports the
number of treatments for which each model achieved
the highest overall ranking.
This summary is useful for identifying models that consistently perform well across multiple treatments.
Models with higher win frequencies generally demonstrate greater robustness across a dataset, although treatment-specific performance should also be considered.
A data frame summarizing the number and proportion of treatment-level wins for each model.
compare_models_by_treatment,
rank_models_by_treatment,
best_model_by_treatment,
compare_models
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_models <- best_model_by_treatment( ranking ) model_win_frequency( best_models )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_models <- best_model_by_treatment( ranking ) model_win_frequency( best_models )
Converts ANKOM RF timestamps into elapsed incubation time expressed in hours.
parse_ankom_time(time_raw)parse_ankom_time(time_raw)
time_raw |
Character vector containing ANKOM timestamps. |
ANKOM RF systems record measurements using timestamps. This function converts those timestamps into elapsed incubation time, measured relative to the first observation.
The resulting values are used throughout rumenGP for:
Data processing
Model fitting
Visualization
Model comparison
In most workflows, this function is called
automatically by process_ankom() and
does not need to be used directly.
A numeric vector containing elapsed incubation time in hours.
read_ankom,
process_ankom,
example_data
timestamps <- c( "2024-01-01 08:00:00", "2024-01-01 12:00:00", "2024-01-01 20:00:00" ) parse_ankom_time( timestamps ) # Typical workflow 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 ) head( gp$Time_h )timestamps <- c( "2024-01-01 08:00:00", "2024-01-01 12:00:00", "2024-01-01 20:00:00" ) parse_ankom_time( timestamps ) # Typical workflow 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 ) head( gp$Time_h )
Displays observed and predicted gas production values for all bottles in a fitted model.
plot_all_fits(fit)plot_all_fits(fit)
fit |
A fitted model object produced by one of the rumenGP model-fitting functions. |
Each panel corresponds to a single bottle and shows:
Observed gas production values
Model predictions
This plot is useful for quickly evaluating model performance across all bottles in a dataset.
A ggplot2 object.
plot_fit,
plot_residuals,
fit_groot
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_all_fits( fit )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_all_fits( fit )
Compares observed and predicted treatment means across multiple fitted models.
plot_all_treatment_means(..., show_se = TRUE)plot_all_treatment_means(..., show_se = TRUE)
... |
Fitted model objects. |
show_se |
Logical. If |
The observed treatment mean is shown as a black line with optional standard-error bands. Predicted treatment means from each fitted model are overlaid for comparison.
This visualization is useful for evaluating model performance at the treatment level rather than at the individual bottle level.
A ggplot2 object.
plot_treatment_mean,
compare_models,
fit_groot,
fit_gompertz
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 ) plot_all_treatment_means( Groot = groot_fit, Gompertz = gompertz_fit )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 ) plot_all_treatment_means( Groot = groot_fit, Gompertz = gompertz_fit )
Creates diagnostic histograms for a fitted model.
plot_diagnostics(fit)plot_diagnostics(fit)
fit |
A fitted model object. |
Diagnostic plots can be used to assess:
Residual distributions
Parameter estimates
Model fit quality
Potential outliers
These plots are useful for evaluating whether model assumptions appear reasonable and for identifying problematic fits.
A named list of ggplot2 objects.
plot_fit,
plot_residuals,
flag_model,
fit_groot
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_diagnostics( fit )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_diagnostics( fit )
Visualizes the rapid pool, slow pool, total predicted gas production, and observed gas production for a fitted dual-pool logistic model.
plot_dual_pools(fit, head = NULL, treatment = NULL)plot_dual_pools(fit, head = NULL, treatment = NULL)
fit |
A |
head |
Optional bottle identifier. If supplied, only that bottle will be plotted. |
treatment |
Optional treatment name. If supplied, a representative bottle from that treatment will be plotted. |
The plot helps interpret the relative contributions of rapidly and slowly fermentable fractions through time.
Components displayed include:
Observed gas production
Predicted total gas production
Rapid fermentation pool
Slow fermentation pool
This visualization is useful for understanding substrate heterogeneity and fermentation dynamics.
A ggplot2 object.
fit_dual_logistic,
plot_fit,
plot_residuals
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_dual_logistic( gp ) plot_dual_pools( fit, head = 1 )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_dual_logistic( gp ) plot_dual_pools( fit, head = 1 )
Plots observed and predicted gas production values for an individual bottle.
plot_fit(fit, head = NULL)plot_fit(fit, head = NULL)
fit |
A fitted model object. |
head |
Optional Head identifier. If omitted and only one bottle is present, that bottle is plotted automatically. |
Observed measurements are displayed alongside the fitted model curve, allowing visual assessment of model performance.
This visualization is useful for:
Evaluating model fit
Identifying systematic deviations
Inspecting individual fermentation profiles
Comparing observed and predicted values
A ggplot2 object.
plot_all_fits,
plot_residuals,
fit_groot
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 a specific bottle plot_fit( fit, head = 1 )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 a specific bottle plot_fit( fit, head = 1 )
Plots observed gas production measurements for an individual bottle.
plot_gp(data, head)plot_gp(data, head)
data |
A |
head |
Bottle identifier to plot. |
This visualization displays the raw gas production profile prior to model fitting and is useful for:
Inspecting fermentation dynamics
Identifying unusual observations
Evaluating data quality
Comparing individual bottle profiles
A ggplot2 object.
plot_fit,
plot_residuals,
process_ankom
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 ) plot_gp( gp, head = 1 )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 ) plot_gp( gp, head = 1 )
Displays observed gas production values together with predictions from multiple fitted models for a single bottle.
plot_model_comparison(..., head)plot_model_comparison(..., head)
... |
Fitted model objects. |
head |
Head identifier. |
This visualization is useful for:
Comparing competing kinetic models
Evaluating model performance
Identifying differences among fitted curves
Assessing model agreement with observations
Observed measurements are displayed alongside predictions from each supplied model, allowing direct visual comparison.
A ggplot2 object.
compare_models,
plot_model_comparison_all,
plot_model_comparison_treatment,
fit_groot,
fit_gompertz
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 ) plot_model_comparison( Groot = groot_fit, Gompertz = gompertz_fit, head = 1 )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 ) plot_model_comparison( Groot = groot_fit, Gompertz = gompertz_fit, head = 1 )
Displays observed and predicted gas production values for multiple fitted models across all bottles.
plot_model_comparison_all(...)plot_model_comparison_all(...)
... |
Fitted model objects. |
Observed values are shown alongside model predictions, allowing visual comparison of competing kinetic models across the entire dataset.
This visualization is useful for:
Comparing model performance
Evaluating agreement between models
Identifying systematic deviations
Exploring treatment responses
A ggplot2 object.
compare_models,
plot_model_comparison,
plot_model_comparison_treatment,
fit_groot,
fit_gompertz
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 ) plot_model_comparison_all( Groot = groot_fit, Gompertz = gompertz_fit )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 ) plot_model_comparison_all( Groot = groot_fit, Gompertz = gompertz_fit )
Displays observed and predicted gas production values for multiple fitted models across all replicates of a selected treatment.
plot_model_comparison_treatment(..., treatment)plot_model_comparison_treatment(..., treatment)
... |
Fitted model objects. |
treatment |
Treatment name. |
Observed measurements are displayed alongside model predictions, allowing visual comparison of competing kinetic models within a treatment.
This visualization is useful for:
Comparing competing models
Evaluating model performance by treatment
Assessing agreement among biological replicates
Identifying systematic prediction errors
A ggplot2 object.
compare_models_by_treatment,
plot_model_comparison,
plot_model_comparison_all,
fit_groot,
fit_gompertz
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 ) plot_model_comparison_treatment( Groot = groot_fit, Gompertz = gompertz_fit, treatment = unique( gp$Treatment )[1] )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 ) plot_model_comparison_treatment( Groot = groot_fit, Gompertz = gompertz_fit, treatment = unique( gp$Treatment )[1] )
Visualizes model performance metrics produced by
compare_models().
plot_model_performance(comparison)plot_model_performance(comparison)
comparison |
Output from
|
This plot provides a graphical comparison of competing models using goodness-of-fit statistics.
Typical metrics include:
R-squared (R²)
Root Mean Squared Error (RMSE)
Residual Sum of Squares (RSS)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The visualization helps identify models that balance goodness of fit and model complexity.
A ggplot2 object.
compare_models,
rank_models,
plot_model_rankings
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( Groot = groot_fit, Gompertz = gompertz_fit ) plot_model_performance( comparison )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( Groot = groot_fit, Gompertz = gompertz_fit ) plot_model_performance( comparison )
Visualizes model rankings across multiple performance metrics.
plot_model_rankings(ranking)plot_model_rankings(ranking)
ranking |
Output from
|
Rankings are typically based on 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 visualization helps identify models that consistently perform well across several evaluation criteria.
A ggplot2 object.
rank_models,
compare_models,
plot_model_performance
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( Groot = groot_fit, Gompertz = gompertz_fit ) ranking <- rank_models( comparison ) plot_model_rankings( ranking )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( Groot = groot_fit, Gompertz = gompertz_fit ) ranking <- rank_models( comparison ) plot_model_rankings( ranking )
Displays residuals from multiple fitted models for a selected bottle.
plot_residual_comparison(..., head)plot_residual_comparison(..., head)
... |
Fitted model objects. |
head |
Head identifier. |
Residuals are calculated as:
and can be used to evaluate:
Model bias
Systematic prediction errors
Heteroscedasticity
Relative model performance
Models with residuals that are randomly distributed around zero are generally preferred over models showing systematic patterns.
A ggplot2 object.
plot_residuals,
plot_model_comparison,
compare_models,
fit_groot,
fit_gompertz
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 ) plot_residual_comparison( Groot = groot_fit, Gompertz = gompertz_fit, head = 1 )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 ) plot_residual_comparison( Groot = groot_fit, Gompertz = gompertz_fit, head = 1 )
Plots residuals for an individual bottle.
plot_residuals(fit, head = NULL)plot_residuals(fit, head = NULL)
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. |
Residuals are calculated as:
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.
A ggplot2 object.
plot_fit,
plot_residual_comparison,
plot_diagnostics,
fit_groot
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 )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 )
Compares observed and predicted treatment means across multiple fitted models for a selected treatment.
plot_treatment_mean(..., treatment, show_se = TRUE)plot_treatment_mean(..., treatment, show_se = TRUE)
... |
Fitted model objects. |
treatment |
Treatment name. |
show_se |
Logical. If |
The observed treatment mean is displayed as a black line with optional standard-error bands. Predicted treatment means from each fitted model are overlaid for visual comparison.
This visualization is useful for:
Comparing competing kinetic models
Evaluating treatment-level model performance
Assessing agreement between observations and predictions
Comparing fermentation dynamics among models
A ggplot2 object.
plot_all_treatment_means,
compare_models_by_treatment,
fit_groot,
fit_gompertz
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 ) plot_treatment_mean( Groot = groot_fit, Gompertz = gompertz_fit, treatment = unique( gp$Treatment )[1] )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 ) plot_treatment_mean( Groot = groot_fit, Gompertz = gompertz_fit, treatment = unique( gp$Treatment )[1] )
Converts pressure measurements to estimated gas volumes using the ideal gas law.
pressure_to_volume( pressure, pressure_unit = c("psi", "kpa"), headspace_volume, headspace_unit = c("mL", "L"), temperature = 39 )pressure_to_volume( pressure, pressure_unit = c("psi", "kpa"), headspace_volume, headspace_unit = c("mL", "L"), temperature = 39 )
pressure |
Numeric pressure values. |
pressure_unit |
Pressure unit. One of:
|
headspace_volume |
Headspace volume. |
headspace_unit |
Headspace volume unit. One of:
|
temperature |
Incubation temperature in degrees Celsius. |
The function supports pressure measurements in PSI or kPa and headspace volumes in mL or L.
Gas volume is estimated using the ideal gas law:
where:
is pressure
is headspace volume
is gas moles
is the gas constant
is absolute temperature
Estimated gas moles are converted to an equivalent gas volume.
A numeric vector containing estimated gas volumes in mL.
# Convert PSI measurements pressure_to_volume( pressure = c( 0.5, 1.0, 1.5 ), pressure_unit = "psi", headspace_volume = 60, headspace_unit = "mL", temperature = 39 ) # Convert kPa measurements pressure_to_volume( pressure = c( 5, 10, 15 ), pressure_unit = "kpa", headspace_volume = 0.06, headspace_unit = "L", temperature = 39 )# Convert PSI measurements pressure_to_volume( pressure = c( 0.5, 1.0, 1.5 ), pressure_unit = "psi", headspace_volume = 60, headspace_unit = "mL", temperature = 39 ) # Convert kPa measurements pressure_to_volume( pressure = c( 5, 10, 15 ), pressure_unit = "kpa", headspace_volume = 0.06, headspace_unit = "L", temperature = 39 )
Converts raw ANKOM RF output into a standardized dataset suitable for rumenGP analyses.
process_ankom( raw_data, metadata = NULL, headspace_ml = 210, temperature_c = 39, zero_negative_pressure = FALSE )process_ankom( raw_data, metadata = NULL, headspace_ml = 210, temperature_c = 39, zero_negative_pressure = FALSE )
raw_data |
Raw ANKOM data table. |
metadata |
Metadata table. |
headspace_ml |
Bottle headspace volume (mL). |
temperature_c |
Incubation temperature (°C). |
zero_negative_pressure |
Logical. If |
The function:
Merges ANKOM measurements with metadata
Removes Head 0 (the ANKOM receiver/base station)
Converts pressure measurements to gas volumes
Applies headspace and temperature corrections
Produces a standardized rumen_gp object
Head 0 is reserved by the ANKOM RF system as the receiver/base station and is automatically removed during processing.
A rumen_gp object containing:
Time points
Gas production values
Bottle identifiers
Treatment assignments
Additional metadata
read_ankom,
read_metadata,
as_rumen_gp,
plot_gp
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 ) head(gp) # Alternative behavior: # convert negative pressures to zero gp_zeroed <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39, zero_negative_pressure = TRUE ) head(gp_zeroed)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 ) head(gp) # Alternative behavior: # convert negative pressures to zero gp_zeroed <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39, zero_negative_pressure = TRUE ) head(gp_zeroed)
Ranks fitted models using multiple model performance criteria.
rank_models(comparison)rank_models(comparison)
comparison |
Output of
|
Rankings are based on metrics produced by
compare_models() and may include:
R-squared (R²)
Root Mean Squared Error (RMSE)
Residual Sum of Squares (RSS)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
Models that perform consistently well across multiple metrics typically receive better overall rankings.
This function is useful when comparing several competing kinetic models and identifying those that provide the best balance between fit quality and model complexity.
A data frame containing model rankings across performance metrics.
compare_models,
rank_models_by_treatment,
plot_model_performance,
plot_model_rankings
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( Groot = groot_fit, Gompertz = gompertz_fit ) rank_models( comparison )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( Groot = groot_fit, Gompertz = gompertz_fit ) rank_models( comparison )
Ranks fitted models within each treatment
using performance metrics produced by
compare_models_by_treatment().
rank_models_by_treatment(comparison)rank_models_by_treatment(comparison)
comparison |
Output from
|
Rankings can be based on 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 is useful for identifying the best-performing model within each treatment and for evaluating whether model performance varies among treatments.
A data frame containing model rankings for each treatment and performance metric.
compare_models_by_treatment,
best_model_by_treatment,
model_win_frequency,
rank_models
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 ) rank_models_by_treatment( comparison )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 ) rank_models_by_treatment( comparison )
Reads a raw ANKOM RF export file and returns the contents as a data frame.
read_ankom(file)read_ankom(file)
file |
Path to an ANKOM Excel file. |
This function is typically the first step in the ANKOM workflow:
Import ANKOM data
Import metadata
Process data
Fit kinetic models
The imported data can subsequently be processed
using process_ankom().
A data frame containing raw ANKOM RF data.
read_metadata,
process_ankom,
example_data
files <- example_data() raw_data <- read_ankom( files$ankom ) head( raw_data ) # Typical workflow metadata <- read_metadata( files$metadata ) gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39 ) head( gp )files <- example_data() raw_data <- read_ankom( files$ankom ) head( raw_data ) # Typical workflow metadata <- read_metadata( files$metadata ) gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39 ) head( gp )
Reads metadata associated with an ANKOM RF experiment.
read_metadata(file, sheet = "metadata")read_metadata(file, sheet = "metadata")
file |
Path to a metadata file. |
sheet |
Sheet name containing metadata. |
Metadata are used to identify bottles, treatments, replicates, and other experimental information required for downstream analyses.
This function is typically used together with:
read_ankom()
process_ankom()
as part of the standard ANKOM workflow.
A data frame containing experimental metadata.
read_ankom,
process_ankom,
validate_metadata,
example_data
files <- example_data() metadata <- read_metadata( files$metadata ) head( metadata ) # Typical workflow raw_data <- read_ankom( files$ankom ) gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39 ) head( gp )files <- example_data() metadata <- read_metadata( files$metadata ) head( metadata ) # Typical workflow raw_data <- read_ankom( files$ankom ) gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39 ) head( gp )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Brody model.
## S3 method for class 'brody_fit' summary(object, ...)## S3 method for class 'brody_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Parameter estimates
Standard errors (if available)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
This method provides a concise overview of model performance and parameter values for each fitted bottle.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_brody,
plot_fit,
plot_residuals,
compare_models
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_brody( gp ) summary( fit )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_brody( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Burr XII model.
## S3 method for class 'burr_xii_fit' summary(object, ...)## S3 method for class 'burr_xii_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (VF)
Rate parameter (r)
Shape parameter (a)
Shape parameter (p)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The Burr XII model is a highly flexible sigmoidal model capable of describing diverse gas production profiles.
The parameter r controls the speed
of gas production, while a and
p jointly control curve shape,
asymmetry, and inflection behavior.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_burr_xii,
plot_fit,
plot_residuals,
compare_models
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_burr_xii( gp ) summary( fit )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_burr_xii( gp ) summary( fit )
Summarizes a fitted custom nonlinear model.
## S3 method for class 'custom_fit' summary(object, ...)## S3 method for class 'custom_fit' summary(object, ...)
object |
A |
... |
Not used. |
The summary typically reports:
Model name
Model formula
Parameter estimates
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
This method provides a concise overview of
parameter estimates and model performance for
user-defined nonlinear equations fitted with
fit_custom().
Invisibly returns the input
custom_fit object.
fit_custom,
plot_fit,
plot_residuals,
compare_models
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 ) custom_fit <- fit_custom( data = gp, formula = Gas_mL ~ A * ( Time_h / ( Time_h + K ) ), start = list( A = 150, K = 10 ), lower = c( A = 0, K = 0 ), model_name = "Hyperbolic" ) summary( custom_fit )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 ) custom_fit <- fit_custom( data = gp, formula = Gas_mL ~ A * ( Time_h / ( Time_h + K ) ), start = list( A = 150, K = 10 ), lower = c( A = 0, K = 0 ), model_name = "Hyperbolic" ) summary( custom_fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted dual-pool logistic model.
## S3 method for class 'dual_logistic_fit' summary(object, ...)## S3 method for class 'dual_logistic_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Rapid pool gas volume (V1F)
Slow pool gas volume (V2F)
Rapid pool rate constant (k1)
Slow pool rate constant (k2)
Lag time (lambda)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The Dual Logistic model partitions fermentation into rapidly and slowly degradable fractions, providing a biologically informative description of fermentation dynamics.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_dual_logistic,
plot_dual_pools,
plot_fit,
compare_models
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_dual_logistic( gp ) summary( fit )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_dual_logistic( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted EXP0 model.
## S3 method for class 'exp0_fit' summary(object, ...)## S3 method for class 'exp0_fit' summary(object, ...)
object |
An |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (Vf)
Fractional rate constant (k)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The EXP0 model describes gas production as an exponential approach to an asymptotic gas volume without an explicit lag phase.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_exp0,
plot_fit,
plot_residuals,
compare_models
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_exp0( gp ) summary( fit )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_exp0( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted EXPL model.
## S3 method for class 'expl_fit' summary(object, ...)## S3 method for class 'expl_fit' summary(object, ...)
object |
An |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (Vf)
Fractional rate constant (k)
Lag time (lambda)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The EXPL model describes gas production as an exponential approach to an asymptotic gas volume following a lag phase.
The lag parameter represents the delay before substantial fermentation begins.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_expl,
plot_fit,
plot_residuals,
compare_models
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_expl( gp ) summary( fit )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_expl( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Gompertz model.
## S3 method for class 'gompertz_fit' summary(object, ...)## S3 method for class 'gompertz_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (A)
Maximum gas production rate (mu)
Lag time (lambda)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The modified Gompertz model provides a biologically meaningful description of fermentation kinetics by explicitly estimating:
Final gas production potential
Maximum fermentation rate
Lag phase duration
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_gompertz,
plot_fit,
plot_residuals,
compare_models
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_gompertz( gp ) summary( fit )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_gompertz( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Groot model.
## S3 method for class 'groot_fit' summary(object, ...)## S3 method for class 'groot_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (VF)
Half-time parameter (b)
Shape parameter (k)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The Groot model is a flexible sigmoidal model commonly used in rumen gas production studies.
The parameter b represents the time
required to reach approximately half of the
asymptotic gas production, while k
controls curve shape and steepness.
The Groot model is mathematically equivalent
to the generalized Michaelis-Menten model
implemented in fit_mm().
Parameter correspondence:
VF = A
b = K
k = c
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_groot,
fit_mm,
plot_fit,
plot_residuals,
compare_models
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 ) summary( fit )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 ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Inverse Paralogistic model.
## S3 method for class 'inverse_paralogistic_fit' summary(object, ...)## S3 method for class 'inverse_paralogistic_fit' summary(object, ...)
object |
An |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (VF)
Rate parameter (r)
Shape parameter (a)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The Inverse Paralogistic model is a flexible sigmoidal model capable of describing a broad range of cumulative gas production profiles.
The parameter r controls the speed of
gas production, while a controls curve
shape, steepness, and inflection behavior.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_inverse_paralogistic,
plot_fit,
plot_residuals,
compare_models
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_inverse_paralogistic( gp ) summary( fit )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_inverse_paralogistic( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted LE0 model.
## S3 method for class 'le0_fit' summary(object, ...)## S3 method for class 'le0_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (A)
Fractional rate constant (k)
Shape parameter (d)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The LE0 (Logistic-Exponential) model combines exponential fermentation kinetics with a logistic component to provide additional flexibility in curve shape without requiring an explicit lag phase.
The shape parameter d controls the curvature
of the fermentation profile and can improve fit
performance for sigmoidal gas production data.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_le0,
fit_lel,
plot_fit,
plot_residuals,
compare_models
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_le0( gp ) summary( fit )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_le0( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted LEL model.
## S3 method for class 'lel_fit' summary(object, ...)## S3 method for class 'lel_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (A)
Fractional rate constant (k)
Shape parameter (d)
Lag time (lambda)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The LEL (Logistic-Exponential with Lag) model combines exponential fermentation kinetics with a logistic component and an explicit lag phase.
The lag parameter (lambda) represents the
delay before substantial fermentation begins,
while the shape parameter (d) controls
curve flexibility.
This combination makes the LEL model suitable for describing complex sigmoidal fermentation profiles with delayed onset.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_lel,
fit_le0,
plot_fit,
plot_residuals,
compare_models
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_lel( gp ) summary( fit )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_lel( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Logistic model.
## S3 method for class 'logistic_fit' summary(object, ...)## S3 method for class 'logistic_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (A)
Fractional rate constant (k)
Lag time (lambda)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The Logistic model describes gas production using a sigmoidal curve characterized by:
An initial lag phase
A rapid fermentation phase
A plateau approaching asymptotic gas production
The lag parameter (lambda) determines
the position of the sigmoid along the time axis,
while k controls curve steepness.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_logistic,
fit_gompertz,
plot_fit,
plot_residuals,
compare_models
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_logistic( gp ) summary( fit )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_logistic( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Log-logistic model.
## S3 method for class 'loglogistic_fit' summary(object, ...)## S3 method for class 'loglogistic_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (VF)
Rate parameter (r)
Shape parameter (a)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The Log-logistic model is a flexible sigmoidal model capable of describing a broad range of gas production profiles.
The parameter r controls the speed of
gas production, while a controls curve
shape, steepness, and inflection behavior.
The Log-logistic model is mathematically
equivalent to both the Groot model
implemented in fit_groot() and the
generalized Michaelis-Menten model
implemented in fit_mm().
Parameter correspondence:
VF = A
a = c = k
1/r = K = b
All three formulations produce identical fitted values, residuals, diagnostics, AIC, BIC, RMSE, and R-squared when corresponding parameter values are used.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_loglogistic,
fit_groot,
fit_mm,
plot_fit,
plot_residuals,
compare_models
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_loglogistic( gp ) summary( fit )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_loglogistic( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Mitscherlich model.
## S3 method for class 'mitscherlich_fit' summary(object, ...)## S3 method for class 'mitscherlich_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (A)
Fractional rate constant (k)
Diffusion or shape parameter (d)
Lag time (lambda)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The Mitscherlich model combines an exponential fermentation component with a diffusion-like term, allowing greater flexibility in describing complex fermentation dynamics.
The parameter k represents the primary
fermentation rate, while d adjusts the
shape of the fermentation profile.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_mitscherlich,
plot_fit,
plot_residuals,
compare_models
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_mitscherlich( gp ) summary( fit )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_mitscherlich( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Michaelis-Menten model.
## S3 method for class 'mm_fit' summary(object, ...)## S3 method for class 'mm_fit' summary(object, ...)
object |
A |
... |
Additional arguments passed to methods. |
The summary typically includes:
Asymptotic gas production (A)
Half-time parameter (K)
Shape parameter (c)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The generalized Michaelis-Menten model is a flexible sigmoidal model commonly used to describe cumulative gas production.
The parameter K represents the time
required to reach approximately half of the
asymptotic gas production, while c
controls curve shape and steepness.
The generalized Michaelis-Menten model is
mathematically equivalent to the Groot model
implemented in fit_groot().
Parameter correspondence:
A = VF
K = b
c = k
Both formulations produce identical fitted values and model diagnostics when convergence is achieved.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_mm,
fit_groot,
plot_fit,
plot_residuals,
compare_models
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_mm( gp ) summary( fit )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_mm( gp ) summary( fit )
Summarizes parameter estimates and goodness-of-fit statistics for a fitted Orskov and McDonald model.
## S3 method for class 'orskov_fit' summary(object, ...)## S3 method for class 'orskov_fit' summary(object, ...)
object |
An |
... |
Additional arguments passed to methods. |
The summary typically includes:
Initial gas volume (VF)
Fermentable fraction (b)
Fractional rate constant (k)
Residual Sum of Squares (RSS)
Root Mean Squared Error (RMSE)
R-squared (R²)
Akaike Information Criterion (AIC)
Bayesian Information Criterion (BIC)
The Orskov and McDonald model partitions gas production into:
An intercept term (VF)
A fermentable fraction (b)
The asymptotic gas production is:
The parameter k controls the rate at
which the asymptote is approached.
This model is widely used in ruminant nutrition research because the parameters have straightforward biological interpretation.
A data frame containing parameter estimates and model diagnostics for each fitted bottle.
fit_orskov,
plot_fit,
plot_residuals,
compare_models
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_orskov( gp ) summary( fit )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_orskov( gp ) summary( fit )
Performs quality-control checks on a
rumen_gp object.
validate_ankom(data)validate_ankom(data)
data |
A |
Supported data sources include datasets created by:
process_ankom()
as_rumen_gp()
Validation checks may include:
Required columns
Missing values
Duplicate observations
Time ordering
Gas production values
ANKOM-specific pressure checks
ANKOM-specific checks are performed only when
Gas_PSI is available.
This function is useful for confirming that a dataset is suitable for downstream modeling, visualization, and model comparison workflows.
The validated rumen_gp object.
process_ankom,
as_rumen_gp,
validate_metadata
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 ) validate_ankom( gp ) # Validation also supports datasets # created using as_rumen_gp()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 ) validate_ankom( gp ) # Validation also supports datasets # created using as_rumen_gp()
Validates experimental metadata prior to analysis.
validate_metadata(metadata)validate_metadata(metadata)
metadata |
Metadata table. |
Metadata are required for linking bottles to treatments and biological replicates during data processing and model fitting.
Required columns:
Head
Treatment
Rep
Validation checks may include:
Presence of required columns
Missing values
Duplicate bottle identifiers
Invalid treatment assignments
This function is typically used before
process_ankom() to ensure metadata
are suitable for downstream analyses.
The validated metadata table.
read_metadata,
validate_ankom,
process_ankom,
example_data
files <- example_data() metadata <- read_metadata( files$metadata ) validate_metadata( metadata ) # Typical workflow raw_data <- read_ankom( files$ankom ) gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39 ) head( gp )files <- example_data() metadata <- read_metadata( files$metadata ) validate_metadata( metadata ) # Typical workflow raw_data <- read_ankom( files$ankom ) gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39 ) head( gp )