Skip to contents

fit_growth() validates the input data, builds the nonlinear model formula, fits it with gslnls::gsl_nls(), and returns a predmicror_fit object.

Usage

fit_growth(data, model, time, response = "lnN", start, ...)

Arguments

data

A data frame containing the time and response variables.

model

A model name, either quoted or unquoted. See predmicror_models().

time

Column containing time values, either quoted or unquoted.

response

Column containing the response values, either quoted or unquoted. Defaults to "lnN".

start

Named list of initial parameter values for the selected model.

...

Additional arguments passed to gslnls::gsl_nls().

Value

A predmicror_fit object with the fitted model and metadata.

Details

Growth models expect the response to be the natural logarithm of the microbial concentration, usually lnN.

Examples

data(growthfull)
fit <- fit_growth(
  growthfull,
  model = "HuangFM",
  time = "Time",
  response = "lnN",
  start = list(Y0 = 0, Ymax = 22, MUmax = 1.7, lag = 5)
)
coef(fit)
#>          Y0        Ymax       MUmax         lag 
#>  0.04562398 21.13231520  1.85942431  5.07986566