# \donttest{
## 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)
# }
Run the code above in your browser using DataLab