Learn R Programming

epifitter (version 0.3.0)

fit_nlin: Fits epidemic models using nonlinear aproach

Description

Fits epidemic models (Exponential, Monomolecular, Logistic and Gompertz) using nonlinear approach for estimate parameters.

Usage

fit_nlin(time,
  y,
  starting_par = list(y0 = 0.01, r = 0.03),
  maxiter = 50)

Arguments

time

Numeric vector which refers to the time steps in the epidemics

y

Numeric vector which refers to the disease intensity

starting_par

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

maxiter

Maximun number of iterations

Examples

Run this code
# NOT RUN {
set.seed(1)
epi1 <- sim_logistic(N = 30,
                     y0 = 0.01,
                     dt = 5,
                     r = 0.3,
                     alpha = 0.5,
                     n = 4)
data = data.frame(time =  epi1[,2], y = epi1[,4])
fit_nlin(time = data$time, y =  data$y, starting_par = list(y0 = 0.001, r = 0.03), maxiter = 1024)

# }

Run the code above in your browser using DataLab