Learn R Programming

R0 (version 1.2-4)

plot.R0.S: Plot objects from sensitivity.analysis

Description

Plots objects from sensitivity.analysis

Usage

## S3 method for class 'R0.S':
plot(x, what = "heatmap", time.step = 1, skip = 5, ...)

Arguments

x
Result of sensitivity.analysis (class R0.S)
what
Specify the desired output. Can be "heatmap" (default), "criterion", or both.
time.step
Optional. If date of first observation is specified, number of day between each incidence observation
skip
Number of results to ignore (time period of X days) when looking for highest Rsquared value.
...
Parameters passed to inner functions

Value

  • A data frame with best R0 measure for each possible time period, along with corresponding begin/end dates
  • $max.RsquaredBest R0 measure for each time period, as measured by their Rsquared value.

Details

For internal use. Called by plot.

Examples

Run this code
#Loading package
library(R0)

## Data is taken from the paper by Nishiura for key transmission parameters of an institutional
## outbreak during 1918 influenza pandemic in Germany

data(Germany.1918)
mGT<-generation.time("gamma", c(2.6,1))
## sensitivity analysis for begin between day 1 and 15, and end between day 16 and 30
sen = sensitivity.analysis(sa.type="time", incid=Germany.1918, GT=mGT, begin=1:15, end=16:30, 
                           est.method="EG")
# Waiting for profiling to be done...
# [...]
# Waiting for profiling to be done...
# Warning message:
# If 'begin' and 'end' overlap, cases where begin >= end are skipped.
# These cases often return Rsquared = 1 and are thus ignored. 


## Return data.frame which can be plotted. Provides the best Rsquared measures for each 
## time interval, along with a coloured matrix representing R0 values
## Return 2 plots, and also a list with max.Rsquared and best R0 values for each time period
plot(sen, what=c("criterion","heatmap"))

# $max.Rsquared
# [very big data.frame]
# 
# $best.fit
#     Time.period Begin.dates  End.dates       R Growth.rate  Rsquared CI.lower. CI.upper.
# 122          15  1918-01-07 1918-01-22 1.64098   0.1478316 0.9752564  1.574953  1.710209

Run the code above in your browser using DataLab