fit_secondary_growth {biogrowth}R Documentation

Fit secondary growth models

Description

[Stable]

Fits a secondary growth model to a set of growth rates obtained experimentally. Modelling is done according to the gamma concept proposed by Zwietering (1992) and cardinal parameter models.

Usage

fit_secondary_growth(
  fit_data,
  starting_point,
  known_pars,
  sec_model_names,
  transformation = "sq",
  ...,
  check = TRUE,
  formula = mu ~ .
)

Arguments

fit_data

Tibble with the data used for the fit. It must have one column with the observed growth rate (named mu by default; can be changed using the "formula" argument) and as many columns as needed with the environmental factors.

starting_point

Named vector with initial values for the model parameters to estimate from the data. The growth rate under optimum conditions must be named mu_opt. The rest must be called 'env_factor'+'_'+'parameter'. For instance, the minimum pH for growth is 'pH_xmin'.

known_pars

Named vector of fixed model parameters. Must be named using the same convention as starting_point.

sec_model_names

Named character vector defining the secondary model for each environmental factor.

transformation

Character defining the transformation of mu for model fitting. One of sq (square root; default), log (log-transform) or none (no transformation).

...

Additional arguments passed to modFit().

check

Whether to do some basic checks (TRUE by default).

formula

an object of class "formula" describing the y variable. The right hand side must be ".". By default mu ~ ..

Value

An instance of FitSecondaryGrowth().

Examples

## We use the data included in the package

data("example_cardinal")

## Define the models to fit

sec_model_names <- c(temperature = "Zwietering", pH = "CPM")

## Any model parameter can be fixed

known_pars <- list(mu_opt = 1.2, temperature_n = 1,
    pH_n = 2, pH_xmax = 6.8, pH_xmin = 5.2)

## Initial values must be given for every other parameter

my_start <- list(temperature_xmin = 5, temperature_xopt = 35,
    pH_xopt = 6.5)

## We can now call the fitting function

fit_cardinal <- fit_secondary_growth(example_cardinal, my_start, known_pars, sec_model_names)

## With summary, we can look at the parameter estimates

summary(fit_cardinal)

## The plot function compares predictions against observations

plot(fit_cardinal)

## Passing which = 2, generates a different kind of plot

plot(fit_cardinal, which = 2)
plot(fit_cardinal, which = 2, add_trend = TRUE)
plot(fit_cardinal, which = 2, add_segment = TRUE)


[Package biogrowth version 1.0.1 Index]