fit_growthmodel {growthrates} | R Documentation |
Fit Nonlinear Parametric Growth Model
Description
Determine maximum growth rates by fitting nonlinear models.
Usage
fit_growthmodel(
FUN,
p,
time,
y,
lower = -Inf,
upper = Inf,
which = names(p),
method = "Marq",
transform = c("none", "log"),
control = NULL,
...
)
Arguments
FUN |
function of growth model to be fitted. |
p |
named vector of start parameters and initial values of the growth model. |
time |
vector of independent variable. |
y |
vector of dependent variable (concentration of organisms). |
lower |
lower bound of the parameter vector (optional). |
upper |
upper bound of the parameter vector (optional). |
which |
vector of parameter names that are to be fitted. |
method |
character vector specifying the optimization algorithm (see |
transform |
fit model to non-transformed or log-transformed data. |
control |
A list of control parameters for the optimizers. See Details. |
... |
additional parameters passed to the optimizer. |
Details
This function calls modFit
from package FME.
Syntax of control parameters and available options may differ, depending
on the optimizer used, except control=list(trace=...)
that switches
tracing on and off for all methods and is either TRUE
, or FALSE
,
or an integer value like 0, 1, 2, 3, depending on the optimizer.
Value
object with parameters of the fit.
See Also
modFit
about constrained fitting of models to data
Other fitting functions:
all_easylinear()
,
all_growthmodels()
,
all_splines()
,
fit_easylinear()
,
fit_spline()
Examples
data(bactgrowth)
splitted.data <- multisplit(bactgrowth, c("strain", "conc", "replicate"))
## get one element either by index or by name
dat <- splitted.data[[1]]
dat <- splitted.data[["D:0:1"]]
p <- c(y0 = 0.01, mumax = 0.2, K = 0.1)
## unconstraied fitting
fit1 <- fit_growthmodel(FUN = grow_logistic, p = p, dat$time, dat$value)
coef(fit1)
summary(fit1)
## optional box-constraints
lower <- c(y0 = 1e-6, mumax = 0, K = 0)
upper <- c(y0 = 0.05, mumax = 5, K = 0.5)
fit1 <- fit_growthmodel(
FUN = grow_logistic, p = p, dat$time, dat$value,
lower = lower, upper = upper)
plot(fit1, log="y")