Skip to contents

Fit monomolecular, logistic, and Gompertz epidemic models using nonlinear regression while also estimating the maximum disease intensity parameter `K`.

Usage

fit_nlin2(
  time,
  y,
  starting_par = list(y0 = 0.01, r = 0.03, K = 0.8),
  maxiter = 50
)

Arguments

time

Numeric vector of assessment times.

y

Numeric vector of disease intensity values.

starting_par

Named list with starting values for `y0`, `r`, and `K`. When omitted or partially specified, `epifitter` supplies data-driven fallback values.

maxiter

Maximum number of iterations. Must be a positive number.

Value

A list with fit statistics, parameter estimates, and prediction data.

Examples

set.seed(1)
epi <- sim_logistic(N = 30, y0 = 0.01, dt = 5, r = 0.3, alpha = 0.5, n = 4)
fit_nlin2(
  time = epi$time,
  y = epi$random_y * 0.8,
  starting_par = list(y0 = 0.01, r = 0.1, K = 0.8),
  maxiter = 1024
)
#> Results of fitting population models 
#> 
#> Stats:
#>                  CCC r_squared    RSE
#> Gompertz      0.9954    0.9915 0.0333
#> Logistic      0.9646    0.9370 0.0907
#> Monomolecular     NA        NA     NA
#> 
#>  Infection rate:
#>                Estimate  Std.error     Lower     Upper
#> Gompertz      0.2870933 0.02151228 0.2427880 0.3313987
#> Logistic      0.1820370 0.03123483 0.1177076 0.2463663
#> Monomolecular        NA         NA        NA        NA
#> 
#>  Initial inoculum:
#>                   Estimate    Std.error         Lower        Upper
#> Gompertz      2.220446e-16 2.149695e-15 -4.205336e-15 4.649425e-15
#> Logistic      3.923556e-02 1.668975e-02  4.862385e-03 7.360874e-02
#> Monomolecular           NA           NA            NA           NA
#> 
#>  Maximum disease intensity:
#>                Estimate  Std.error     Lower     Upper
#> Gompertz      0.7766917 0.01357448 0.7487345 0.8046489
#> Logistic      1.0000000 0.09237762 0.8097447 1.1902553
#> Monomolecular        NA         NA        NA        NA