% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plots.R
\name{plot.ShrinkageTreesPrediction}
\alias{plot.ShrinkageTreesPrediction}
\title{Plot posterior predictive survival curves}
\usage{
\method{plot}{ShrinkageTreesPrediction}(x, type = "survival", obs = NULL, t_grid = NULL, level = 0.95, ...)
}
\arguments{
\item{x}{A \code{ShrinkageTreesPrediction} object returned by
\code{\link{predict.ShrinkageTrees}} for a survival model.}

\item{type}{Character; currently only \code{"survival"} is supported.}

\item{obs}{Integer vector of predicted-observation indices for individual
survival curves, or \code{NULL} (default) for the population-averaged
curve across all predicted observations.}

\item{t_grid}{Optional numeric vector of time points (on the original
time scale) at which to evaluate the survival function. If \code{NULL}
(default), a grid of 200 equally spaced points is generated
automatically.}

\item{level}{Width of the pointwise credible band. Default \code{0.95}.}

\item{...}{Additional arguments (currently unused).}
}
\value{
A \pkg{ggplot2} object.
}
\description{
Plots posterior predictive survival curves for new observations from
a \code{ShrinkageTreesPrediction} object. Only available for survival
outcome types (\code{"right-censored"} or \code{"interval-censored"}).
}
\examples{
\donttest{
if (requireNamespace("ggplot2", quietly = TRUE)) {
  set.seed(1)
  n <- 40; p <- 3
  X <- matrix(rnorm(n * p), ncol = p)
  X_test <- matrix(rnorm(10 * p), ncol = p)
  time <- rexp(n, rate = exp(0.5 * X[, 1]))
  status <- rbinom(n, 1, 0.7)

  fit_surv <- SurvivalBART(
    time = time, status = status, X_train = X,
    number_of_trees = 5, N_post = 50, N_burn = 25,
    store_posterior_sample = TRUE, verbose = FALSE
  )

  pred <- predict(fit_surv, newdata = X_test)
  plot(pred, type = "survival")
}
}
}
\seealso{
\code{\link{predict.ShrinkageTrees}},
\code{\link{plot.ShrinkageTrees}}
}
