plot.egf {epigrowthfit} | R Documentation |
Plot Nonlinear Mixed Effects Models of Epidemic Growth
Description
A method for printing objects of class egf
.
Usage
## S3 method for class 'egf'
plot(x, type = c("interval", "cumulative", "rt"),
time_as = c("Date", "numeric"), delta = 1, log = TRUE, zero = NA,
show_predict = TRUE, show_doubling = FALSE, level = 0.95,
control = egf_control_plot(), cache = NULL, plot = TRUE,
subset = NULL, order = NULL, xlim = NULL, ylim = NULL,
main = NULL, sub = NULL, xlab = NULL, ylab = NULL, ...)
Arguments
x |
an |
type |
a character string indicating a type of plot. The options are:
interval incidence ( |
time_as |
a character string indicating how numeric times are displayed
on the bottom axis. The options are:
as is ( |
delta |
a positive number indicating a step size on the time axis.
Predicted curves are evaluated on a grid with this spacing.
When |
log |
a logical. If |
zero |
a positive number indicating a line on which to plot zeros when
|
show_predict |
an integer flag: 2 is to draw predicted curves with confidence bands, 1 is draw predicted curves only, 0 is to draw neither. |
show_doubling |
an integer flag: 2 is to print initial doubling time estimates in the top margin with confidence intervals, 1 is to print estimates only, 0 is to print neither. Nothing is printed for models without a well-defined initial exponential growth rate. |
level |
a number in the interval |
control |
an |
cache |
a |
plot |
a logical. If |
subset |
an index vector for the rows of
|
order |
a permutation of |
xlim , ylim |
numeric vectors of length 2 specifying axis limits, which are
recycled for all plots.
If |
main , sub , xlab , ylab |
character or expression vectors or ( |
... |
unused optional arguments. |
Details
Computation of fitted and predicted values and standard errors is performed before any plots are created. To avoid waste of computation time, cached computations are returned even if an error is thrown during plotting. To ensure that the cache is preserved, assign the result of the function call to a name:
cache <- plot(x, \dots)
.
Caching functionality must be used with care, as mismatch between
x
and cache
will not be detected. Constructions such
as plot(y, cache = plot(x, ...), ...)
, where x
and y
are different egf
objects, should not be expected
to produce correct results.
Value
A data frame inheriting from class plot.egf
.
If argument cache
was supplied in the function call,
then this data frame is the result of augmenting cache
with any new computations.
See Also
The generic function plot
.
Examples
example("egf", package = "epigrowthfit")
l <- list(legend = list(cex = 0.8),
value = list(cex = 0.8, font = 2),
ci = list(cex = 0.8))
control <- egf_control_plot(doubling = l)
op <- par(mar = c(3.5, 5, 5, 1))
plot(m1,
type = "interval",
show_predict = 2L,
show_doubling = 2L,
control = control)
plot(m1,
type = "cumulative",
main = "Fitted exponential model",
sub = quote(paste("Country", country)))
par(op)
op <- par(mar = c(3.5, 9.5, 5, 1))
plot(m1, type = "rt", subset = quote(country %in% LETTERS[4:6]))
par(op)