Skip to contents

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

Usage

fit_cardinal(data, model, x, response = "sqrtGR", start, ...)

Arguments

data

A data frame containing the environmental factor and response variables.

model

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

x

Column containing the environmental factor values, either quoted or unquoted.

response

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

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

Cardinal models expect the response to be the square root of the growth rate, usually sqrtGR.

Examples

data(salmonella)
fit <- fit_cardinal(
  salmonella,
  model = "CMTI",
  x = "Temp",
  response = "sqrtGR",
  start = list(Tmax = 42, Tmin = 1, MUopt = 1, Topt = 37)
)
coef(fit)
#>       Tmax       Tmin      MUopt       Topt 
#> 49.0325643  5.0267901  0.7520581 40.3670855