% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/npests.R
\name{plot.npmle}
\alias{plot.npmle}
\title{Plot estimates from an NPMLE fit}
\usage{
\method{plot}{npmle}(
  x,
  ci = TRUE,
  level = 0.95,
  ctype = c("log-log", "log", "plain"),
  target = c("survival", "cumhaz", "ainv", "sel_prob"),
  ...
)
}
\arguments{
\item{x}{An \code{npmle} object. See \code{\link[=npmle]{npmle()}}.}

\item{ci}{Whether to plot pointwise confidence intervals (default \code{TRUE}).}

\item{level}{Confidence level for the pointwise confidence intervals (default
0.95).}

\item{ctype}{Type of confidence interval.
\itemize{
\item \code{"plain"}: linear confidence intervals from a normal approximation.
\item \code{"log"}: back-transformed confidence intervals from the natural log scale.
Guaranteed to be non-negative.
\item \code{"log-log"} (the default): for the survival function and selection
probability, back-transformed confidence intervals from the (natural) log
minus log scale, which are guaranteed to be between zero and one.
For the normalized inverse probability weights and cumulative hazard,
the same confidence intervals as \code{"log"} are used.
}}

\item{target}{Which NPMLE quantity to plot.
\itemize{
\item \code{"survival"} (the default): the event time survival function.
\item \code{"cumhaz"}: the event time cumulative hazard function.
\item \code{"ainv"}: the normalized inverse probability weights at each observed
event time. See \code{\link[=npmle]{npmle()}}.
\item \code{"sel_prob"}: the selection (non-truncation) probability as a function of
time.
}}

\item{...}{Additional arguments passed to other methods.}
}
\value{
After displaying the plot, a list with two elements is returned
invisibly.
The first element \code{ests} is a data frame with the columns \code{time},
\code{est}, \code{lower}, and \code{upper}, containing the point estimates and their computed
confidence intervals.
The second element \code{plot} is the plotted object returned by \code{\link[ggplot2:ggplot]{ggplot2::ggplot()}}.
}
\description{
Given a fitted NPMLE from \code{\link[=npmle]{npmle()}}, plot various quantities related to the
event time or truncation time distributions along with pointwise confidence
intervals.
The estimates and standard errors are computed by \code{\link[=plot.npmle]{plot.npmle()}} if they
were not included in the \code{npmle} fit.
}
\examples{
fit <- npmle(Survdt(incu, ltrunc, rtrunc),
             data = aids)
plot(fit)

plot(fit, target = "cumhaz")
}
\seealso{
\code{\link[=npmle]{npmle()}}
}
