Learn R Programming

earlyR (version 0.0.5)

sample_R: Get a sample of plausible Reproduction Numbers

Description

This function derives a sample of plausible R values from an earlyR object (as returned by get_R). The probability of each returned values of R are directly proportional to their likelihood.

Usage

sample_R(x, n = 100)

Arguments

x

An earlyR object.

n

The number of R values to sample.

Examples

Run this code
# NOT RUN {
if (require(incidence)) {
 x <- incidence(c(1, 5, 5, 12, 45, 65))
 plot(x)
 res <- get_R(x, disease = "ebola")
 res
 plot(res)

 sample_R(res, 10)
 hist(sample_R(res, 1000), col = "grey", border = "white")
}

# }

Run the code above in your browser using DataLab