growthmodel {growthrates} | R Documentation |
Create a User-defined Parametric Growth Model
Description
This constructor method allows to create user-defined functions that can be used as parametric models describing time-dependent growth of organisms.
Usage
growthmodel(x, pnames = NULL)
Arguments
x |
a function with arguments |
pnames |
character vector with the names of the model parameters. |
Details
Package growthrates has a plug-in architecture allowing user-defined growth models of the following form:
identifier <- function(time, parms) { ... content of function here ... return(as.matrix(data.frame(time=time, y=y))) }
where time
is a numeric vector and parms
a named, non-nested
list of model parameters. The constructor function growthmodel
is used to attach the names of the parameters as an optional
attribute.
See Also
Other growth models:
grow_baranyi()
,
grow_exponential()
,
grow_gompertz2()
,
grow_gompertz()
,
grow_huang()
,
grow_logistic()
,
grow_richards()
,
ode_genlogistic()
,
ode_twostep()
Examples
test <- function(time, parms) {
with(as.list(parms), {
y <- (K * y0) / (y0 + (K - y0) * exp(-mumax * time)) + y_shift
return(as.matrix(data.frame(time=time, y=y)))
})
}
mygrowthmodel <- growthmodel(test, c("y0", "mumax", "K", "y_shift"))