MyNixOS website logo
Description

Poisson Super Learner.

Provides tools for fitting piecewise-constant hazard models for survival and competing risks data, including ensemble hazard estimation via the Super Learner framework. The package supports estimation of survival functions and absolute risk predictions from fitted cause-specific hazard models. For the Super Learner framework see van der Laan, Polley and Hubbard (2007) <doi:10.2202/1544-6115.1309>.

R-CMD-check

Poisson SuperLearner

The package provides an implementation of piecewise-constant hazard models for time-to-event analysis of survival and competing risks data. The piecewise-constant hazard models can be combined in an ensemble, the Poisson Superlearner, via cross-validated risk minimization for flexible hazard estimation. It enables estimation of survival functions and absolute risk predictions.

The package provides:

  • Flexible specification of base learners (e.g. penalized and unpenalized Poisson regression).
  • Automatic time-splitting into piecewise-constant hazard intervals.
  • Cross-validated ensemble learning.
  • Absolute risk prediction at arbitrary time horizons.

Installation

# install.packages("devtools")
# devtools::install_github("gpitt71/poissonsuperlearner")

library(poissonsuperlearner)

Example: Piecewise-Constant Hazard Model

Fit a single PCH model and obtain absolute risk predictions.

library(poissonsuperlearner)

set.seed(42)

# Simulate synthetic survival data
d <- simulateStenoT1(
  n = 50,
  scenario = "alpha"
)

# Define an unpenalized Poisson hazard learner
l_glm <- Learner_glmnet(
  covariates = c("sex", "diabetes_duration"),
  cross_validation = FALSE,
  lambda = 0
)

# Fit piecewise-constant hazard model
fit_glm <- fit_learner(
  data = d,
  id = "id",
  status = "event",
  event_time = "time",
  learner = l_glm,
  number_of_nodes = 5
)

# Absolute risk prediction at time horizon t = 5
predictRisk(fit_glm, newdata = d[1, ], times = 5)

What happens internally?

  • The follow-up time is split into number_of_nodes intervals.
  • A Poisson regression is fitted to the expanded dataset.
  • The estimated hazards are integrated to produce survival and absolute risk.

Example: Superlearner for Piecewise Hazards

Combine multiple hazard learners into an ensemble.

library(poissonsuperlearner)

set.seed(42)

d <- simulateStenoT1(
  n = 50,
  scenario = "alpha"
)

# Base learner 1: unpenalized Poisson regression
l_glm <- Learner_glmnet(
  covariates = c("sex", "diabetes_duration"),
  cross_validation = FALSE,
  lambda = 0
)

# Base learner 2: Lasso-penalized Poisson regression
l_lasso <- Learner_glmnet(
  covariates = c("value_Smoking", "value_LDL"),
  cross_validation = TRUE,
  alpha = 1
)

learners_list <- list(
  glm   = l_glm,
  lasso = l_lasso
)

# Fit the superlearner
sl_fit <- Superlearner(
  data = d,
  id = "id",
  status = "event",
  event_time = "time",
  learners = learners_list,
  number_of_nodes = 5
)

# Absolute risk prediction from the ensemble
predictRisk(sl_fit, newdata = d[1, ], times = 5)

Superlearner workflow

  1. Each base learner is fitted on cross-validation folds.
  2. Out-of-sample Poisson deviance is computed.
  3. A meta-learner combines the base hazard predictions.
  4. Final hazards are aggregated and converted to absolute risk.

For competing risks, learners may also be a list of cause-specific learner libraries, one library per cause. Predictions can be requested from the stacked ensemble (model = "sl"), the discrete super learner (model = "discrete_sl"), or named/indexed base learners.


Main Functions

  • Learner_glmnet() - define a Poisson hazard learner.
  • Learner_gam() - define a Poisson GAM hazard learner.
  • Learner_hal() - define a HAL-style Poisson hazard learner.
  • fit_learner() - fit a single piecewise-constant hazard model.
  • Superlearner() - fit an ensemble of hazard learners.
  • predict() - obtain hazards, survival, and absolute risk predictions.
  • predictRisk() - obtain risk matrices compatible with riskRegression.

Typical Use Case

poissonsuperlearner is designed for:

  • Survival analysis via Poisson representations.
  • Flexible hazard modeling with regularization.
  • Ensemble-based absolute risk prediction.
  • Methodological research in time-to-event modeling.

The package focuses on modular learners, transparent cross-validation, and direct control of the piecewise hazard structure.

Metadata

Version

0.2.0

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows