make_guess_primary: Initial guesses for fitting primary growth models

View source: R/initial_guesses.R

make_guess_primaryR Documentation

Initial guesses for fitting primary growth models

Description

[Experimental]

The function uses some heuristics to provide initial guesses for the parameters of the growth model selected that can be used with fit_growth().

Usage

make_guess_primary(
  fit_data,
  primary_model,
  logbase_mu = 10,
  formula = logN ~ time
)

Arguments

fit_data

the experimental data. A tibble (or data.frame) with a column named time with the elapsed time and one called logN with the logarithm of the population size

primary_model

a string defining the equation of the primary model, as defined in primary_model_data()

logbase_mu

Base of the logarithm the growth rate is referred to. By default, 10 (i.e. log10). See vignette about units for details.

formula

an object of class "formula" describing the x and y variables. logN ~ time as a default.

Value

A named numeric vector of initial guesses for the model parameters

Examples


## An example of experimental data

my_data <- data.frame(time = 0:9, 
                      logN = c(2, 2.1, 1.8, 2.5, 3.1, 3.4, 4, 4.5, 4.8, 4.7))
                      
## We just need to pass the data and the model equation

make_guess_primary(my_data, "Logistic")

## We can use this together with fit_growth()

fit_growth(my_data,
           list(primary = "Logistic"),
           make_guess_primary(my_data, "Logistic"),
           c()
           )

## The parameters returned by the function are adapted to the model

make_guess_primary(my_data, "Baranyi")

## It can express mu in other logbases 

make_guess_primary(my_data, "Baranyi", logbase_mu = exp(1))  # natural
make_guess_primary(my_data, "Baranyi", logbase_mu = 2)  # base2


biogrowth documentation built on May 29, 2024, 4:17 a.m.