title: "Getting Started with rumenGP" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{Getting Started with rumenGP} %\VignetteEngine{knitr::rmarkdown} \usepackage[utf8]{inputenc}
knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
rumenGP provides a complete workflow for analyzing in vitro rumen gas production experiments.
The package supports:
This vignette demonstrates a complete workflow using the packaged ANKOM example dataset.
library(rumenGP)
The package includes a small example dataset.
files <- example_data() files
Import the ANKOM RF output file and metadata table.
raw_data <- read_ankom( files$ankom ) metadata <- read_metadata( files$metadata )
Before processing data, validate the metadata table.
metadata <- validate_metadata( metadata )
Convert pressure measurements into cumulative gas production.
gp <- process_ankom( raw_data, metadata, headspace_ml = 210, temperature_c = 39, zero_negative_pressure = TRUE )
The resulting dataset is a standardized
rumen_gp object.
gp <- validate_ankom( gp ) class(gp)
Inspect the data:
head(gp)
Individual bottle profiles can be visualized.
plot_gp( gp, head = "1" )
Several built-in models are available.
groot_fit <- fit_groot(gp) gompertz_fit <- fit_gompertz(gp) brody_fit <- fit_brody(gp)
Each model provides parameter estimates and diagnostic statistics.
summary(groot_fit)
flags <- flag_model( groot_fit ) head(flags)
Observed and predicted values can be visualized.
plot_fit( groot_fit, head = "1" )
Residual plots help identify systematic deviations.
plot_residuals( groot_fit, head = "1" )
Compare model performance using multiple metrics.
comparison <- compare_models( Groot = groot_fit, Gompertz = gompertz_fit, Brody = brody_fit ) comparison
The comparison table includes:
rank_models(
comparison
)
Treatment-level comparisons are also available.
treatment_comparison <- compare_models_by_treatment( Groot = groot_fit, Gompertz = gompertz_fit, Brody = brody_fit ) treatment_comparison
ranked_treatments <- rank_models_by_treatment( treatment_comparison ) ranked_treatments
best_models <- best_model_by_treatment( ranked_treatments ) best_models
model_win_frequency(
best_models
)
A typical workflow is:
Import data
↓
Validate metadata
↓
Process ANKOM data
↓
Validate processed data
↓
Fit models
↓
Flag problematic bottles
↓
Inspect residuals
↓
Exclude problematic bottles
↓
Refit models
↓
Compare models
Example bottle exclusion:
gp_clean <- exclude_heads( gp, heads = c("10"), reason = "Sensor malfunction" )
Current built-in models:
The Groot and generalized Michaelis-Menten models are mathematically equivalent.
Parameter correspondence:
Researchers may choose either formulation depending on the terminology commonly used in their field.
Additional package capabilities include:
gp <- as_rumen_gp( data = my_data, head_col = "Bottle", time_col = "Time", gas_col = "Gas" )
gp <- as_rumen_gp( data = my_data, head_col = "Bottle", time_col = "Time", pressure_col = "PSI", pressure_unit = "psi", headspace_volume = 60 )
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" )
See:
?as_rumen_gp ?fit_custom
for additional details.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.