run_simulation: Runs the spatial epidemic simulation (Raster)

Description Usage Arguments Details Value Examples

View source: R/run_simulation.R

Description

Simulates an epidemic using the provided RasterLayer, spatial kernel, contact matrix, and infection parameters.

Usage

1
2
run_simulation(rasterl, D, contact_mat, beta, sigma = 1/2.6, stoch = FALSE,
  step = 1, start_area = 1, start_num = 10, t_max = 100)

Arguments

rasterl

The RasterLayer object containing the population data.

D

The expanded kernel matrix to use for FOI calculation (generated by the calc_beta function).

contact_mat

The contact matrix for mixing between age groups.

beta

The beta value for the epidemic (calculated from a given R0 using the calc_beta function).

sigma

The recovery rate for the epidemic (must match the one used to calculate beta from R0 using the calc_beta function).

stoch

Logical. If TRUE, the simulation is stochastic.

step

Size of time step for stochastic simulation, in days (default is 1 day).

start_area

Where to start the epidemic. 1: Most highly populated area (default), 2: A random area in the middle of the country (typically medium population density), 3: A random area in the north of the country (typically low population density). NOTE: CURRENTLY ONLY SUPPORTS OPTION 1

start_num

Number of infected individuals to start the epidemic.

t_max

How many days to run the simulation for.

Details

This functions requires specific objects to run. These can be generated using the prep_simulation function (e.g. if you want to simulate an epidemic using the RasterLayer object "toy_data", you must prep_simulation(toy_data) first). The model used is an SIR model, where individuals can be either Susceptible, Infected or Recovered with regards to the disease. This assumes that Infected individuals are infectious, and that Recovered individuals are immune and cannot be reinfected.

Value

Returns one dataframe object containing the estimates of Susceptible, Infected and Recovered individuals for each time step.

Examples

1
2
3
4
5
6
7
8
9
#Create a RasterLayer object:
test_data = raster(nrow=10, ncol=10, xmn=1, xmx=100000, ymn=1, ymx=100000)
values(test_data) = runif(100, 1, 1000)

#Calculate the parameters for the simulation:
prep_simulation(test_data)

#Run the simulation:
results = run_simulation(test_data, expanded_D, contact_mat, beta)

qleclerc/efficientspatial documentation built on May 23, 2019, 1:24 p.m.