plot.cmfit {cyclomort} | R Documentation |
Plot cmfit objects
Description
Plot cmfit objects
Usage
## S3 method for class 'cmfit'
plot(
x,
plotCI = TRUE,
CI.level = 0.95,
histogram = TRUE,
add = FALSE,
monthlabs = FALSE,
nreps = 5000,
hazcolor = "black",
alpha = 0.3,
ymax = NULL,
prediction = NULL,
yaxt = par()$yaxt,
...
)
Arguments
x |
a cmfit object |
plotCI |
whether confidence intervals should also be drawn. |
CI.level |
confidence level (default 0.95) for CIs (if CI is TRUE) |
histogram |
boolean dictating whether a histogram of actual mortalities will be included in the plot |
add |
boolean dictating whether the plot will be added to an existing plot |
monthlabs |
whether or not to label the x-axis with months - suitable for (common) annual seasonal data. If FALSE, labels are numeric within the period [0,1] |
nreps |
number of samples from parameter estimates for confidence intervals (see |
hazcolor |
color of lines for hazard function and confidence intervals |
alpha |
transparency of confidence interval polygon |
ymax |
maximum value for the y-axis - can be useful for scaling purposes |
prediction |
an optional |
yaxt |
location for y-axis label |
... |
additional parameters to |
Value
a plot comparing the estimated mortality curve (based on parameter estimates) and the actual results (as a histogram).
See Also
predict.cmfit
Examples
# Simulate data
T.morts1 <- simulate_cycloSurv(1000, period = 365,
meanhazard = 0.3 / 365,
peaks = c(0.25 * 365, 0.75 * 365),
durations = c(0.3 * 365, 0.1 * 365),
weights = c(0.7,0.3),
plotme = FALSE)
# Estimate simulated data
fits <- fit_cyclomort(T.morts1, n.seasons = 2)
fits
# Plot results
plot(fits, nreps = 1000, monthlabs = TRUE)
# NB: `nreps` is for the bootstrap of the confidence interval
# The default (5000) is slower but smoother
# Actual parameter values from simulated data
attributes(T.morts1)