fit_multi: Estimate model parameters for multiple disease progress...

Description Usage Arguments Value See Also Examples

View source: R/fit_multi.R

Description

Estimate model parameters for multiple disease progress curves

Usage

1
2
3
4
5
6
7
8
fit_multi(time_col,
             intensity_col,
             data,
             strata_cols ,
             starting_par = list(y0 = 0.01, r = 0.03, K =  0.8),
             maxiter=500,
             nlin = FALSE,
             estimate_K = FALSE)

Arguments

time_col

Character name specifying the column for the time. eg: time_col = "days".

intensity_col

Character name specifying the column for the disease intensity.

data

data.frame object containing the variables for model fitting.

strata_cols

Character name or vector specifying the columns for stratification.

starting_par

Starting value for initial inoculun (y0) and apparent infection rate (r). Please informe in that especific order

maxiter

Maximum number of iterations. Only used if is nlin = TRUE

nlin

Logical. If FALSE estimates parameters using data linearization. If nlin=TRUE, estimates nonlinear approach. fit_nlin.

estimate_K

Logical. If nlin=TRUE, estimates maximum disease intensity. (default: nlin=FALSE) fit_nlin2.

Value

Returns a data.frame containing estimated parameters for individual strata levels.

See Also

fit_lin,fit_nlin,fit_nlin2

Examples

 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
set.seed(1)
# create stratified dataset
data_A1 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.3, alpha = 0.5, n = 4)
data_A1 = dplyr::mutate(data_A1,
                        fun = "A",
                        cultivar = "BR1")
set.seed(1)
data_B1 = sim_gompertz(N = 30, y0 = 0.01, dt = 5, r = 0.2, alpha = 0.5, n = 4)
data_B1 = dplyr::mutate(data_B1,
                        fun = "B",
                        cultivar = "BR1")
set.seed(1)
data_A2 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.1, alpha = 0.5, n = 4)
data_A2 = dplyr::mutate(data_A2,
                        fun = "A",
                        cultivar = "BR2")
set.seed(1)
data_B2 = sim_gompertz(N = 30, y0 = 0.01,dt = 5, r = 0.1, alpha = 0.5, n = 4)
data_B2 = dplyr::mutate(data_B2,
                        fun = "B",
                        cultivar = "BR2")

data = dplyr::bind_rows(data_A1, data_B1,data_A2, data_B2)

fit_multi(time_col = "time",
             intensity_col = "random_y",
             data = data,
             strata_col = c("fun","cultivar"),
             starting_par = list(y0 = 0.01, r = 0.03),
             maxiter = 1024,
             nlin = FALSE,
             estimate_K = FALSE)

epifitter documentation built on June 14, 2021, 5:08 p.m.