
Predict microbial growth under dynamic environmental conditions
Source:R/dynamic_growth.R
predict_dynamic_growth.Rdpredict_dynamic_growth() solves a differential Huang-type growth model over
a time-varying environmental profile. It is intended for forward prediction
under dynamic temperature conditions and uses an internal fourth-order
Runge-Kutta solver.
Usage
predict_dynamic_growth(
profile,
model = "huang",
secondary = "huang_sqrt",
start,
times = NULL,
scale = c("log10", "ln"),
dt = 0.01,
method = "rk4",
temperature = "temperature"
)Arguments
- profile
A
dynamic_profile()object or data frame with atimecolumn and an environmental variable, usuallytemperature.- model
Character string. Currently only
"huang"is supported.- secondary
Character string defining the secondary model for the growth rate. One of
"huang_sqrt","huang_full_sqrt", or"constant".- start
Named list of parameters. Use
logN0andlogNmaxfor base-10 input, orY0andYmaxfor natural-log input. Forsecondary = "huang_sqrt", supplyaandTmin. Forsecondary = "huang_full_sqrt", also supplybandTmax. Forsecondary = "constant", supplyMUmax.- times
Optional numeric vector of output times. If
NULL, a regular sequence covering the profile is created fromdt.- scale
Scale of the returned
responsecolumn. One of"log10"or"ln".- dt
Maximum integration step used by the internal RK4 solver.
- method
Solver method. Currently only
"rk4"is implemented.- temperature
Name of the temperature column in
profile.
Value
A predmicror_dynamic_prediction data frame with time, prediction,
lnN, logN, temperature, and metadata attributes.
Examples
profile <- dynamic_profile(
time = c(0, 5, 10, 15, 20),
temperature = c(10, 4, 15, 15, 10)
)
pred <- predict_dynamic_growth(
profile = profile,
start = list(logN0 = 2, logNmax = 8.8, a = 0.0886, Tmin = 8.91, lag = 2),
dt = 0.25
)
head(pred)
#> dynamic_growth prediction
#> model: huang
#> secondary: huang_sqrt
#> rows: 6
#> time response lnN logN temperature
#> 1 0.00 2.000000 4.605170 2.000000 10.0
#> 2 0.25 2.000000 4.605171 2.000000 9.7
#> 3 0.50 2.000001 4.605173 2.000001 9.4
#> 4 0.75 2.000002 4.605174 2.000002 9.1
#> 5 1.00 2.000002 4.605174 2.000002 8.8
#> 6 1.25 2.000002 4.605174 2.000002 8.5