Learn R Programming

SPOT (version 2.1.10)

evalMarkovChain: evalMarkovChain

Description

Evaluation function for the optimization of continuous time Markov chains models using SIR models.

Usage

evalMarkovChain(x, conf)

Arguments

x

vector of parameter values, i.e., parameters of the MarkovChain model to evaluate with the function.

p

num [0;1] proportion of confirmed cases

beta

num Transmission rate from susceptible to infected. See SIR.

gamma

num Recovery rate from infected to recovered. See SIR.

CFR

num Case Fatalities Rate

conf

a list with entries

regionData

A data frame with observations of 3 variables:

date

Date, format: "2020-01-22" "2020-01-23" "2020-01-24" "2020-01-25" ...

confirmed

num 0 0 0 0 0 0 0 0 0 0 ..

fatalities

fatalities: num 0 0 0 0 0 0 0 0 0 0 ...

N

N population size

Value

value (log RMSE)

Details

Performs a SIR model simulation for one specific parameter setting using the modelMarkovChain function and evaluates the result from the simulation model output with the real data. The RMSE is used as the performance metric.

Examples

Run this code
# NOT RUN {
require("SimInf")
data <- preprocessInputData(regionTrain, regionPopulation)
set.seed(123)
data <- data[[1]]
N <- attr(data, "regionPopulation")
## x = (p, beta, gamma, CFR)
x <- c(0.01, 0.01, 0.1, 0.01)
## Simulate only 2 days
conf <- list(regionData = data[1:2, ], N = N)
evalMarkovChain(x = x, conf=conf)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab