plot.earlyR {earlyR}R Documentation

Plot earlyR objects

Description

These functions are designed for plotting earlyR objects, output by the function get_R. It can plot either the likelihood of R values, or the force of infection over time (see argument type). For points, the latter is used.

Usage

## S3 method for class 'earlyR'
plot(x, type = c("R", "lambdas"), scale = "ml", ...)

## S3 method for class 'earlyR'
points(x, scale = 1, ...)

Arguments

x

A earlyR object.

type

The type of graphic to be generated, matching either "R" or "lamdbas"; "R" will plot the likelihood of R values; "lambdas" will plot the force of infection over time; see 'scale' argument to interprete the force of infection.

scale

A numeric value indicating the total number of new cases expected over the time period of the lambdas, or a recognised 'character' string; lambdas will be scaled to correspond to the number of expected cases every day; defaults to 'ml', which tells function to use the maximum likelihood estimate of *R* multiplied by the number of infectious cases

...

Further arguments to be passed to other methods; for the plot of *R*, '...' is passed to 'ggplot2::geom_line()'; for the plot of *lambdas*, '...' is passed to 'ggplot2::geom_bar()'.

Value

A 'ggplot2' object.

if (require(incidence))

## example: onsets on days 1, 5, 6 and 12; estimation on day 24 onset <- c(1, 5, 6, 12) x <- incidence(onset, last_date = 24) x

res <- get_R(x, disease = "ebola") res plot(res) plot(res, "lambdas")

Author(s)

Thibaut Jombart thibautjombart@gmail.com


[Package earlyR version 0.0.5 Index]