% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/SuperSurv-methods.R
\name{coef.SuperSurv}
\alias{coef.SuperSurv}
\title{Extract SuperSurv ensemble coefficients}
\usage{
\method{coef}{SuperSurv}(object, type = c("event", "censoring", "both"), ...)
}
\arguments{
\item{object}{A fitted object of class \code{"SuperSurv"}.}

\item{type}{Character string specifying which weights to return. Use
\code{"event"} for the event-time ensemble, \code{"censoring"} for the
censoring ensemble, or \code{"both"} for both sets of weights.}

\item{...}{Additional arguments ignored.}
}
\value{
For \code{type = "event"} or \code{type = "censoring"}, a named
numeric vector of ensemble weights. For \code{type = "both"}, a list with
elements \code{event} and \code{censoring}.
}
\description{
Returns the optimized convex-combination weights from a fitted
\code{SuperSurv} object.
}
\examples{
if (requireNamespace("glmnet", quietly = TRUE)) {
  data("metabric", package = "SuperSurv")
  dat <- metabric[1:80, ]
  x_cols <- grep("^x", names(dat))[1:5]
  X <- dat[, x_cols, drop = FALSE]
  new.times <- seq(20, 120, by = 20)

  fit <- SuperSurv(
    time = dat$duration,
    event = dat$event,
    X = X,
    newdata = X,
    new.times = new.times,
    event.library = c("surv.coxph", "surv.ridge"),
    cens.library = c("surv.coxph"),
    control = list(saveFitLibrary = TRUE)
  )

  coef(fit)
  coef(fit, type = "both")
}
}
