make_guess_coupled: Initial guesses for fitting the Baranyi-Ratkowsky model

View source: R/guess_coupled.R

make_guess_coupledR Documentation

Initial guesses for fitting the Baranyi-Ratkowsky model

Description

[Experimental]

The function uses some heuristics to provide initial guesses for the parameters of the Baranyi-Ratkowsky model selected that can be used with fit_coupled_growth().

Usage

make_guess_coupled(fit_data, mode = "two_steps")

Arguments

fit_data

Tibble (or data.frame) of data for the fit. The shape of the data will depend on the fitting mode (see fit_coupled_growth())

mode

the type of model fitting approach. Either two_steps (fitted from the values of mu and lambda) or one_step (fitted from logN)

logbase_mu

Base for the definition of mu. By default, exp(1) (natural logarithm).

logbase_logN

Base for the definition of logN. By default, 10 (decimal logarithm).

Value

A named numeric vector of initial guesses for the model parameters

Examples

## Example 1: Two-steps fitting-------------------------------------------------

data(example_coupled_twosteps)

guess <- make_guess_coupled(example_coupled_twosteps)


show_guess_coupled(example_coupled_twosteps, guess)

my_fit <- fit_coupled_growth(example_coupled_twosteps, 
                             start = guess,
                             mode = "two_steps")

print(my_fit)
coef(my_fit)
summary(my_fit)
plot(my_fit)

## Example 2: One-step fitting--------------------------------------------------

data("example_coupled_onestep")

guess <- make_guess_coupled(example_coupled_onestep, mode = "one_step")

show_guess_coupled(example_coupled_onestep,
                   guess,
                   "one_step")

my_fit <- fit_coupled_growth(example_coupled_onestep,
                             start = guess,
                             mode = "one_step")

print(my_fit)
coef(my_fit)
summary(my_fit)
plot(my_fit)

 

albgarre/biogrowth documentation built on April 12, 2025, 9:46 a.m.