% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predictRisk.R
\name{predictRisk.poisson_superlearner}
\alias{predictRisk.poisson_superlearner}
\title{Absolute-risk matrix predictions for a fitted Poisson Super Learner}
\usage{
\method{predictRisk}{poisson_superlearner}(object, newdata, times, cause = 1, model = "sl", ...)
}
\arguments{
\item{object}{\code{poisson_superlearner}. Fitted object.}

\item{newdata}{\code{data.frame}. New covariate data.}

\item{times}{\code{numeric}. Prediction times.}

\item{cause}{\code{numeric(1)}. Cause index.}

\item{model}{Scalar model selector. Default is \code{"sl"}. Allowed values are the
same as in \code{\link[=predict.poisson_superlearner]{predict.poisson_superlearner()}}.}

\item{...}{Unused.}
}
\value{
\code{numeric} matrix with \code{nrow(newdata)} rows and \code{length(times)} columns.
}
\description{
S3 method compatible with \code{riskRegression::predictRisk} returning one column
per requested time.
}
\examples{
d <- simulateStenoT1(30, competing_risks = TRUE)

learners <- list(
  lasso = Learner_glmnet(
    covariates = "sex",
    alpha = 1,
    lambda = 0.01,
    cross_validation = FALSE
  ),
  ridge = Learner_glmnet(
    covariates = c("sex", "value_LDL"),
    alpha = 0,
    lambda = 0.01,
    cross_validation = FALSE
  )
)

fit <- Superlearner(
  data = d,
  id = "id",
  status = "status_cvd",
  event_time = "time_cvd",
  learners = learners,
  number_of_nodes = 3,
  nfold = 2
)

if (requireNamespace("riskRegression", quietly = TRUE)) {
  riskRegression::predictRisk(fit, newdata = d[1:3], times = c(1, 3), cause = 1)
}

}
