predict_growth_uncertainty {biogrowth}R Documentation

Isothermal growth with parameter uncertainty

Description

[Stable]

Simulation of microbial growth considering uncertianty in the model parameters. Calculations are based on Monte Carlo simulations, considering the parameters follow a multivariate normal distribution.

Usage

predict_growth_uncertainty(
  model_name,
  times,
  n_sims,
  pars,
  corr_matrix = diag(nrow(pars)),
  check = TRUE,
  logbase_mu = logbase_logN,
  logbase_logN = 10
)

Arguments

model_name

Character describing the primary growth model.

times

Numeric vector of storage times for the simulations.

n_sims

Number of simulations.

pars

A tibble describing the parameter uncertainty (see details).

corr_matrix

Correlation matrix of the model parameters. Defined in the same order as in pars. An identity matrix by default (uncorrelated parameters).

check

Whether to do some tests. FALSE by default.

logbase_mu

Base of the logarithm the growth rate is referred to. By default, the same as logbase_logN. See vignette about units for details.

logbase_logN

Base of the logarithm for the population size. By default, 10 (i.e. log10). See vignette about units for details.

Details

The distributions of the model parameters are defined in the pars argument using a tibble with 4 columns:

Value

An instance of GrowthUncertainty().

Examples


## Definition of the simulation settings

my_model <- "Baranyi"
my_times <- seq(0, 30, length = 100)
n_sims <- 3000

library(tibble)

pars <- tribble(
    ~par, ~mean, ~sd, ~scale,
    "logN0", 0, .2, "original",
    "mu", 2, .3, "sqrt",
    "lambda", 4, .4, "sqrt",
    "logNmax", 6, .5, "original"
)

## Calling the function

stoc_growth <- predict_growth_uncertainty(my_model, my_times, n_sims, pars)

## We can plot the results

plot(stoc_growth)

## Adding parameter correlation

my_cor <- matrix(c(1,   0,   0, 0,
    0,   1, 0.7, 0,
    0, 0.7,   1, 0,
    0,   0,   0, 1),
    nrow = 4)

stoc_growth2 <- predict_growth_uncertainty(my_model, my_times, n_sims, pars, my_cor)

plot(stoc_growth2)

## The time_to_size function can calculate the median growth curve to reach a size

time_to_size(stoc_growth, 4)

## Or the distribution of times

dist <- time_to_size(stoc_growth, 4, type = "distribution")
plot(dist)





[Package biogrowth version 1.0.4 Index]