MyNixOS website logo
Description

Fitting Predictive Microbiology Models.

Provides predictive microbiology model functions and convenience wrappers for fitting primary growth, microbial inactivation, dynamic, omnibus, and cardinal parameter models to experimental data using nonlinear least squares and related mixed-effects or time-varying workflows. Includes helper functions for extracting fitted values, calculating model diagnostics, and comparing fitted models. Implemented model families include those described by: Zwietering et al. (1990) <doi:10.1128/AEM.56.6.1875-1881.1990>, Baranyi and Roberts (1994) <doi:10.1016/0168-1605(94)90157-0>, Baranyi and Roberts (1995) <doi:10.1016/0168-1605(94)00121-L>, Buchanan et al. (1997) <doi:10.1006/fmic.1997.0125>, Richards (1959) <doi:10.1093/jxb/10.2.290>, Fang et al. (2012) <doi:10.1111/j.1750-3841.2012.02873.x>, Fang et al. (2013) <doi:10.1016/j.fm.2012.12.005>, Huang (2008) <doi:10.1111/j.1750-3841.2008.00785.x>, Huang (2009) <doi:10.1016/j.jfoodeng.2008.07.011>, Huang (2013) <doi:10.1016/j.foodcont.2012.11.019>, Geeraerd et al. (2005) <doi:10.1016/j.ijfoodmicro.2004.11.038>, van Boekel (2002) <doi:10.1016/S0168-1605(01)00742-5>, Peleg (1999) <doi:10.1016/S0963-9969(99)00081-2>, Mafart et al. (2002) <doi:10.1016/S0168-1605(01)00624-9>, Albert and Mafart (2005) <doi:10.1016/j.ijfoodmicro.2004.10.016>, Rosso et al. (1993) <doi:10.1006/jtbi.1993.1099>, Rosso et al. (1995) <doi:10.1128/AEM.61.2.610-616.1995>, and Rosso et al. (1996) <doi:10.4315/0362-028X-59.9.944>.

predmicror

R-CMD-check pkgdown License: GPLv3

predmicror provides predictive microbiology model functions and convenience wrappers for fitting primary growth, microbial inactivation, and cardinal parameter models to experimental data. It also supports omnibus (nonlinear mixed-effects) and dynamic (ODE-based time-varying) modelling.

The package can be used in two complementary ways:

  • call the exported model equations directly inside gslnls::gsl_nls();
  • use the higher-level fit_*() wrappers for routine fitting, diagnostics, and model comparison.

Installation

install.packages("devtools")
devtools::install_github("fsqanalytics/predmicror")

Model catalogue

List all supported models with:

library(predmicror)

predmicror_models()
predmicror_models("growth")
predmicror_models("inactivation")
predmicror_models("cardinal")
WorkflowWrapperResponse scaleExamples
Primary growthfit_growth()natural log (lnN)HuangFM, BaranyiFM, RossoFM
Microbial inactivationfit_inactivation()base-10 log (logN)WeibullM, GeeraerdST, WeibullPH
Cardinal parametersfit_cardinal()sqrt growth rate (sqrtGR)CMTI, CMPH, CMAW, CMInh
Dynamic (time-varying)fit_dynamic_growth/inactivation()natural log (lnN)Huang ODE, Weibull-Peleg ODE
Omnibus (mixed-effects)fit_omnibus_growth/inactivation()per primary modelany primary + secondary covariates

Quick start: growth

library(predmicror)

data(growthfull)

fit <- fit_growth(
  data = growthfull,
  model = "HuangFM",
  time = "Time",
  response = "lnN",
  start = list(Y0 = 0, Ymax = 22, MUmax = 1.7, lag = 5)
)

summary(fit)
coef(fit)
plot(fit)

Inactivation

data(bixina)

fit <- fit_inactivation(
  data = bixina,
  model = "WeibullM",
  time = "Time",
  response = "lnN",
  start = list(Y0 = 5.6, sigma = 12, alpha = 1)
)

fit_metrics(fit)
plot(fit)

Cardinal parameter model

data(salmonella)

fit <- fit_cardinal(
  data = salmonella,
  model = "CMTI",
  x = Temp,
  response = sqrtGR,
  start = list(Tmax = 42, Tmin = 1, MUopt = 1, Topt = 37)
)

coef(fit)

Model comparison

huang <- fit_growth(growthfull, model = "HuangFM", time = "Time",
  response = "lnN", start = list(Y0 = 0, Ymax = 22, MUmax = 1.7, lag = 5))
baranyi <- fit_growth(growthfull, model = "BaranyiFM", time = "Time",
  response = "lnN", start = list(Y0 = 0, Ymax = 22, MUmax = 1.7, lag = 5))

compare_models(HuangFM = huang, BaranyiFM = baranyi, sort_by = "AIC")

Dynamic (time-varying environment)

profile <- dynamic_profile(
  time = c(0, 5, 10),
  temperature = c(12, 20, 25)
)

pred <- predict_dynamic_growth(
  profile = profile,
  start = list(logN0 = 2, logNmax = 8, a = 0.08, Tmin = 5, lag = 1),
  times = seq(0, 10, length.out = 50)
)

plot(pred$time, pred$logN, type = "l")

Omnibus (mixed-effects)

# Each group (Condition) has its own curve
dat <- data.frame(
  Condition = rep(1:3, each = 7),
  Time = rep(seq(0, 6), 3),
  lnN = HuangNLM(rep(seq(0, 6), 3), Y0 = 2, Ymax = 8, MUmax = 0.6)
)

fit <- fit_omnibus_growth(
  data = dat,
  primary = "HuangNLM",
  time = "Time",
  response = "lnN",
  group = "Condition",
  random = Y0 ~ 1,
  start = c(Y0 = 2, Ymax = 8, MUmax = 0.6)
)

Response scale conventions

The fitting wrappers do not transform the response automatically:

  • Growth models: natural logarithm of concentration (lnN)
  • Inactivation models: base-10 logarithm (logN)
  • Cardinal models: square root of growth rate (sqrtGR)
  • Dynamic models: natural logarithm (lnN)

Documentation

Full reference and vignettes:

https://fsqanalytics.github.io/predmicror/

Citation

citation("predmicror")

Bugs

https://github.com/fsqanalytics/predmicror/issues.

Metadata

Version

1.3.2

License

Unknown

Platforms (79)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    wasip1
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasip1
  • wasm64-wasip1
  • x86_64-cygwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows