Learn R Programming

popEpi (version 0.2.1)

plot.sir: Plot method for sir-object

Description

Plot SIR estimates with error bars

Usage

## S3 method for class 'sir':
plot(x, plot.type = "model", conf.int = TRUE, ylab, xlab,
  xlim, main, eps = 0.2, abline = TRUE, lang = "fi", log = FALSE,
  left.margin, ...)

Arguments

x
an object returned by function sir
plot.type
select 'model'(=default), 'univariate'
conf.int
default TRUE draws confidence intervals
ylab
overwrites default y-axis label
xlab
overwrites default x-axis label
xlim
x-axis minimum and maximum values
main
optional plot title
eps
error bar vertical bar height (works only in 'model' or 'univariate')
abline
logical; draws a gray line in SIR = 1
lang
language: 'fi'(default) or 'en'
log
logical; SIR is not in log scale by default
left.margin
adjust left marginal of the plot to fit long variablenames
...
arguments passed on to plot()

Details

Plot SIR estimates and confidence intervals
  • univariate - plots SIR with univariates confidence intervals
  • model - plots SIR with Poisson modelled confidence intervals
Customize Normal plot parameters can be passed to plot. These can be a vector when plotting error bars:
  • pch- point type
  • lty- line type
  • col- line/point colour
  • lwd- point/line size
Tips for plottin splines It's possible to use plot to first draw the confidence intervals using specific line type or colour and then plotting againg the estimate using lines(... , conf.int = FALSE) with different settings. This works only when plot.type is 'splines'.

See Also

sir, sirspline

Examples

Run this code
# Plot SIR estimates
# plot(sir.by.gender, plot.type = 'model', col = c(4,2), log=FALSE, eps=0.2, lty=1, lwd=2, pch=19,
#      main = 'SIR by gender', abline=TRUE)
#
# # plot SIR splines gender in same plot
# plot(sir.male, plot.type = 'splines', col = c(4), lwd=2,
#      main = 'SIR by gender', abline=TRUE)
# lines(sir.female, col = 2)

Run the code above in your browser using DataLab