fit_isothermal_inactivation: Fit of Isothermal Experiments

View source: R/isothermal_fit.R

fit_isothermal_inactivationR Documentation

Fit of Isothermal Experiments

Description

Fits the parameters of the model chosen to a set of isothermal experiments using nonlinear regression through the function nls.

Usage

fit_isothermal_inactivation(
  model_name,
  death_data,
  starting_point,
  known_params,
  adjust_log = TRUE
)

Arguments

model_name

character specyfing the model to adjust.

death_data

data frame with the experiment data where each row is one observation. It must have the following columns:

  • log_diff: Number of logarithmic reductions at each data point.

  • temp: Temperature of the data point.

  • time: Time of the data point.

starting_point

List with the initial values of the parameters for the adjustment.

known_params

List of the parameters of the model known.

adjust_log

logical. If TRUE, the adjustment is based on the minimization of the error of the logarithmic microbial count. If FALSE, it is based on the minimization of the error of the microbial count. TRUE by default.

Value

An instance of class IsoFitInactivation with the results. This list has four entries:

  • nls: The object of class nls with the results of the adjustment.

  • parameters: a list with the values of the model parameters, both fixed and adjusted.

  • model: a string with the key identifying the model used.

  • data: the inactivation data used for the fit.

See Also

nls

Examples

## EXAMPLE 1 -----------

data("isothermal_inactivation")  # data set used for the example.

get_isothermal_model_data()  # retrieve valid model keys.
model_name <- "Bigelow"  # Bigelow's model will be used for the adjustment.

model_data <- get_isothermal_model_data(model_name)
model_data$params  # Get the parameters of the model

## Define the input arguments

known_params = list(temp_ref = 100)
starting_point <- c(z = 10,D_R = 1)

## Call the fitting function
iso_fit <- fit_isothermal_inactivation(model_name,
                                       isothermal_inactivation, starting_point,
                                       known_params)

## Output of the results

plot(iso_fit, make_gg = TRUE)
goodness_of_fit(iso_fit)

## END EXAMPLE 1 --------


albgarre/bioinactivation documentation built on Nov. 27, 2022, 9:19 a.m.