| MicrobialGrowth | R Documentation |
Regression function to different microbial growth models.
MicrobialGrowth(
x,
y,
model = "gompertz",
clip = c(-Inf, Inf),
start = list(),
lower = list(),
upper = list(),
nls.args = list(),
callbackError = NULL,
...
)
x |
index series or time series. |
y |
values or list of values to regress (should not be logged). |
model |
wanted growth model : "baranyi", "gompertz" or "rosso". |
clip |
a pair of values indicating in which interval to clip the data |
start |
a named list of starting estimates. When |
lower |
a named list of lower bounds. When |
upper |
a named list of upper bounds. When |
nls.args |
additional parameters to use when calling nls. |
callbackError |
function to call on error during regression. |
... |
further arguments passed to or from other methods. |
Use listAvailableModels() function to see all values accepted by model parameter.
The default values for clip, start, lower and upper are calculated based on the given data. These default values can be known through the call member of the returned value.
The nls.args argument is a list that can contain any nls function argument except formula, algorithm, start, lower and upper which are already fixed (via a homonymous or hard-coded argument).
For the callbackError argument, prefer the stop function to block or warning to not be blocking.
a MicrobialGrowth-object composed of
call |
the matched call with several components. |
coefficients |
coefficients obtained by regression. |
data |
data used for regression, once the y values are clipped |
f |
a list of functions such as |
isValid |
a boolean indicating whether the regression was successful or not. |
message |
contains the error message if the regression fails, |
reg |
the |
# Using the embedded data example_data
# Simple example
g <- MicrobialGrowth(example_data$time, example_data$y1, model="gompertz")
# Multiple regression example
G <- MicrobialGrowth(example_data$time, example_data[2:ncol(example_data)], model="gompertz")
# Example of multiple parameter changes
g <- MicrobialGrowth(example_data$time, example_data$y1, model="gompertz",
clip = c(0.15, Inf), start = list(N0=0.1, Nmax=2,
mu=0.05, lambda=40), lower = list(lambda = 40))
# Example of using `nls.args` to apply weight to some data
g <- MicrobialGrowth(example_data$time, example_data$y1, model="gompertz",
nls.args = list(weights = (function(x){(x >= 50 & x <= 70)*9 + 1})(example_data$time)))
# Example of callbackError (remaining non-blocking)
g <- MicrobialGrowth(example_data$time, example_data$y15, model="gompertz",
callbackError = warning)
# Example of callbackError (becoming blocking)
try(
g <- MicrobialGrowth(c(1,2,3,4,5),c(1,1,1,1,1), model="gompertz", callbackError = stop)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.