% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/SurvivalWrappers.R
\name{SurvivalDART}
\alias{SurvivalDART}
\title{SurvivalDART}
\usage{
SurvivalDART(
  time = NULL,
  status = NULL,
  X_train,
  X_test = NULL,
  timescale = "time",
  number_of_trees = 200,
  a_dirichlet = 0.5,
  b_dirichlet = 1,
  rho_dirichlet = NULL,
  k = 2,
  N_post = 1000,
  N_burn = 1000,
  store_posterior_sample = TRUE,
  verbose = TRUE,
  left_time = NULL,
  right_time = NULL,
  ...
)
}
\arguments{
\item{time}{Outcome vector of (non-negative) survival times. Required for
right-censored outcomes; set to \code{NULL} when using interval censoring.}

\item{status}{Event indicator (1 = event, 0 = censored). Required for
right-censored outcomes; derived automatically for interval censoring.}

\item{X_train}{Design matrix for training data.}

\item{X_test}{Optional test matrix. If NULL, predictions are computed at
the column means of \code{X_train}.}

\item{timescale}{Either \code{"time"} (log-transform internally) or
\code{"log"} (already log-transformed).}

\item{number_of_trees}{Number of trees in the ensemble. Default is 200.}

\item{a_dirichlet, b_dirichlet}{Beta hyperparameters controlling sparsity
in the Dirichlet splitting rule.}

\item{rho_dirichlet}{Expected number of active predictors. If NULL,
defaults to the number of covariates in \code{X_train}.}

\item{k}{Scaling constant used to calibrate the prior variance of the
step heights.}

\item{N_post}{Number of posterior samples to store.}

\item{N_burn}{Number of burn-in iterations.}

\item{store_posterior_sample}{Logical; if \code{TRUE} (default), store
the full \eqn{N_\text{post} \times n} matrix of posterior predictions.
Required for \code{predict()}, \code{plot(type = "survival")} with full
posterior credible bands, and custom posterior analyses. Set to
\code{FALSE} to save memory when only posterior means are needed.}

\item{verbose}{Logical; print sampling progress.}

\item{left_time}{Optional numeric vector of left (lower) time boundaries
for interval-censored data. Exact events have
\code{left_time == right_time}; right-censored observations have
\code{right_time = Inf}; interval-censored observations have finite
\code{left_time < right_time}. When provided together with
\code{right_time}, the model is fitted with
\code{outcome_type = "interval-censored"} and \code{time}/\code{status}
are ignored.}

\item{right_time}{Optional numeric vector of right (upper) time boundaries.
Use \code{Inf} for right-censored observations.}

\item{...}{Additional arguments passed to \code{\link{ShrinkageTrees}}
to override default hyperparameters.}
}
\value{
An object of class \code{"ShrinkageTrees"} fitted under a Dirichlet
splitting prior (DART) within an AFT formulation.

See \code{\link{ShrinkageTrees}} for a full description of returned components.
}
\description{
Fits an Accelerated Failure Time (AFT) model using the Dirichlet splitting
prior (DART), which induces structural sparsity through a Beta-Dirichlet
hierarchy on splitting probabilities.
Supports both right-censored and interval-censored survival outcomes.
}
\details{
This function provides a survival-specific wrapper for DART under an
AFT formulation for right-censored or interval-censored outcomes.

For right-censored data, supply \code{time} and \code{status}.
For interval-censored data, supply \code{left_time} and \code{right_time}
instead; event indicators are derived internally following the
\code{survival::Surv(type = "interval2")} convention.

Structural regularisation is induced through a Dirichlet prior on
splitting probabilities, encouraging sparse feature usage in
high-dimensional settings.

Users requiring alternative shrinkage priors on the leaf parameters
(e.g., Horseshoe or half-Cauchy priors) should use
\code{\link{ShrinkageTrees}} directly.
}
\examples{
set.seed(2)
n <- 30; p <- 5
X <- matrix(rnorm(n * p), ncol = p)
time <- rexp(n, rate = exp(0.5 * X[, 1]))
status <- rbinom(n, 1, 0.7)

fit <- SurvivalDART(time = time, status = status, X_train = X,
                    number_of_trees = 5, N_post = 50, N_burn = 25,
                    verbose = FALSE)

# S3 methods
print(fit)
smry <- summary(fit)

# Posterior predictions on new data
X_new <- matrix(rnorm(10 * p), ncol = p)
pred <- predict(fit, newdata = X_new)
print(pred)

# Variable importance and survival plots (requires ggplot2)
if (requireNamespace("ggplot2", quietly = TRUE)) {
  plot(fit, type = "vi", n_vi = 5)

  # Posterior survival curves for training data
  plot(fit, type = "survival")

  # Posterior predictive survival curves for new data
  plot(pred, type = "survival")
  plot(pred, type = "survival", obs = c(1, 5))
}

# Interval-censored example
set.seed(12)
n <- 30; p <- 5
X <- matrix(rnorm(n * p), ncol = p)
true_t <- rexp(n, rate = exp(0.5 * X[, 1]))
left_t  <- true_t * runif(n, 0.5, 1)
right_t <- true_t * runif(n, 1, 1.5)
exact <- sample(n, 10); left_t[exact] <- true_t[exact]; right_t[exact] <- true_t[exact]
rc <- sample(setdiff(seq_len(n), exact), 5); right_t[rc] <- Inf

fit_ic <- SurvivalDART(left_time = left_t, right_time = right_t,
                        X_train = X, number_of_trees = 5,
                        N_post = 50, N_burn = 25, verbose = FALSE)

}
\seealso{
Related models: \code{\link{SurvivalBART}} (standard BART prior),
\code{\link{ShrinkageTrees}} (general shrinkage priors).

S3 methods: \code{\link{print.ShrinkageTrees}},
\code{\link{summary.ShrinkageTrees}},
\code{\link{predict.ShrinkageTrees}},
\code{\link{plot.ShrinkageTrees}}.
}
