| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/plot.Cuminc.R |
| 3 |
\name{plot.Cuminc} |
| 4 |
\alias{plot.Cuminc} |
| 5 |
\title{Plot method for Cuminc objects} |
| 6 |
\usage{ |
| 7 |
\method{plot}{Cuminc}( |
| 8 |
x, |
| 9 |
use.ggplot = FALSE, |
| 10 |
xlab = "Time", |
| 11 |
ylab = "Probability", |
| 12 |
xlim, |
| 13 |
ylim, |
| 14 |
lty, |
| 15 |
legend, |
| 16 |
cols, |
| 17 |
conf.type = c("log", "plain", "none"), |
| 18 |
conf.int = 0.95, |
| 19 |
legend.pos = "right", |
| 20 |
facet = FALSE, |
| 21 |
... |
| 22 |
) |
| 23 |
} |
| 24 |
\arguments{ |
| 25 |
\item{x}{Object of class \code{"Cuminc"} to be printed or plotted} |
| 26 |
|
| 27 |
\item{use.ggplot}{Default FALSE, set TRUE for ggplot version of plot} |
| 28 |
|
| 29 |
\item{xlab}{A title for the x-axis; default is \code{"Time"}} |
| 30 |
|
| 31 |
\item{ylab}{A title for the y-axis; default is \code{"Probability"}} |
| 32 |
|
| 33 |
\item{xlim}{The x limits of the plot(s), default is range of time} |
| 34 |
|
| 35 |
\item{ylim}{The y limits of the plot(s); if ylim is specified for |
| 36 |
type="separate", then all plots use the same ylim for y limits} |
| 37 |
|
| 38 |
\item{lty}{The line type, see \code{\link{par}}; default is 1} |
| 39 |
|
| 40 |
\item{legend}{Character vector corresponding to number of absorbing states. |
| 41 |
In case of a grouped \code{"Cuminc"} object, with facet = FALSE the |
| 42 |
length of the vector is number absorbing states * group levels. |
| 43 |
Only relevant when use.ggplot = TRUE} |
| 44 |
|
| 45 |
\item{cols}{Vector (numeric or character) specifying colours of the lines} |
| 46 |
|
| 47 |
\item{conf.type}{Type of confidence interval - either "log" or "plain" . See |
| 48 |
function details for details.} |
| 49 |
|
| 50 |
\item{conf.int}{Confidence level (\%) from 0-1 for probabilities, |
| 51 |
default is 0.95 (95\% CI). Setting to 0 removes the CIs.} |
| 52 |
|
| 53 |
\item{legend.pos}{The position of the legend, see \code{\link{legend}}; |
| 54 |
default is \code{"topleft"}} |
| 55 |
|
| 56 |
\item{facet}{Logical, in case of group used for \code{"Cuminc"}, facet by it - |
| 57 |
only relevant when use.ggplot = TRUE} |
| 58 |
|
| 59 |
\item{\dots}{Further arguments to plot or print method} |
| 60 |
} |
| 61 |
\value{ |
| 62 |
A ggplot object if use.ggplot = T used, otherwise NULL. |
| 63 |
} |
| 64 |
\description{ |
| 65 |
Plot the estimates of the non-parametric Aalen-Johansen estimate of the |
| 66 |
cumulative incidence functions (competing risks data). Note this is a method |
| 67 |
for \code{mstate::Cuminc} and not \code{cmprsk::cuminc}. Both return the same |
| 68 |
estimates, though the former does so in a dataframe, and the latter in the list. |
| 69 |
} |
| 70 |
\details{ |
| 71 |
Grouped cumulative incidences can be plotted either in the same plot or in facets, |
| 72 |
see the \code{facet} argument. |
| 73 |
} |
| 74 |
\examples{ |
| 75 |
library(ggplot2) |
| 76 |
|
| 77 |
data("aidssi") |
| 78 |
head(aidssi) |
| 79 |
si <- aidssi |
| 80 |
|
| 81 |
# No grouping |
| 82 |
cum_incid <- Cuminc( |
| 83 |
time = "time", |
| 84 |
status = "status", |
| 85 |
data = si |
| 86 |
) |
| 87 |
|
| 88 |
plot( |
| 89 |
x = cum_incid, |
| 90 |
use.ggplot = TRUE, |
| 91 |
conf.type = "none", |
| 92 |
lty = 1:2, |
| 93 |
conf.int = 0.95 |
| 94 |
) |
| 95 |
|
| 96 |
# With grouping |
| 97 |
cum_incid_grp <- Cuminc( |
| 98 |
time = "time", |
| 99 |
status = "status", |
| 100 |
group = "ccr5", |
| 101 |
data = si |
| 102 |
) |
| 103 |
|
| 104 |
plot( |
| 105 |
x = cum_incid_grp, |
| 106 |
use.ggplot = TRUE, |
| 107 |
conf.type = "none", |
| 108 |
lty = 1:4, |
| 109 |
facet = TRUE |
| 110 |
) |
| 111 |
|
| 112 |
} |
| 113 |
\author{ |
| 114 |
Edouard F. Bonneville \email{[email protected]} |
| 115 |
} |