forked from albgarre/biogrowth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
125 lines (83 loc) · 3.66 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# biogrowth <img src="man/figures/logo.png" align="right" width="120" />
```{r, echo=FALSE}
library(badger)
```
<!-- badges: start -->
`r badge_cran_checks("badger")`
`r badge_cran_release("biogrowth", "green")`
`r badge_cran_download("biogrowth", "last-month", "green")`
`r badge_lifecycle("maturing", "blue")`
<!-- badges: end -->
The goal of biogrowth is to ease the development of mathematical models to describe population growth. It includes functions for:
* making predictions under static environmental conditions.
* making predictions under dynamic environmental conditions.
* making predictions under static or dynamic conditions considering parameter uncertainty.
* fitting models to data gathered under static environmental conditions.
* fitting models to data gathered under dynamic environmental conditions.
The fuctions in biogrowth follow the methods of predictive microbiology, where the modelling process is divided two steps: primary and secondary modelling. The user has the flexibility to choose between several primary (Baranyi, modified Gompertz and Trilinear) and secondary models (cardinal parameter model, Zwietering-type model, full Ratkowsky model).
## Authors
The biogrowth package has been developed by researchers of the Food Microbiology Laboratory of Wageningen University and Research.
* Alberto Garre,
* Jeroen Koomen,
* Heidy den Besten,
* Marcel Zwietering.
Questions and comments can be directed to Alberto Garre (alberto.garreperez (at) wur.nl). For bug reports, please use the GitHub page of the project.
## Installation
You can install the released version of biogrowth from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("biogrowth")
```
And the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("albgarre/biogrowth")
```
## Example
As an example of the features included in the package, the following code chunk generates a prediction of microbial growth under dynamic conditions considering parameter uncertainty.
```{r example}
library(tidyverse)
library(biogrowth)
set.seed(1241)
my_model <- "Baranyi"
my_times <- seq(0, 30, length = 100)
n_sims <- 3000
pars <- tribble(
~par, ~mean, ~sd, ~scale,
"logN0", 0, .2, "original",
"mu", 2, .3, "sqrt",
"lambda", 4, .4, "sqrt",
"logNmax", 6, .5, "original"
)
stoc_growth <- predict_stochastic_growth(my_model, my_times, n_sims, pars)
plot(stoc_growth)
```
As an additional example, the following code chunk fits a model to a set of experiments under dynamic conditions.
```{r}
## We will use the multiple_experiments data set
data("multiple_experiments")
## For each environmental factor, we need to defined a model
sec_names <- c(temperature = "CPM", pH = "CPM")
## Any model parameter can be fixed
known <- list(Nmax = 1e8, N0 = 1e0, Q0 = 1e-3,
temperature_n = 2, temperature_xmin = 20, temperature_xmax = 35,
pH_n = 2, pH_xmin = 5.5, pH_xmax = 7.5, pH_xopt = 6.5)
## The rest require starting values for model fitting
start <- list(mu_opt = .8, temperature_xopt = 30)
## We can now call the fitting function
global_fit <- fit_multiple_growth(start, multiple_experiments, known, sec_names)
## Any single environmental factor can be added to the plot using add_factor
plot(global_fit, add_factor = "temperature")
```
This is only a small sample of the functions included in the package. For a complete list, please check the package vignette.