nnmaxheap_C: Project a Vector onto Non-Negative Non-Increasing Space

View source: R/nnmaxheap.R

nnmaxheap_CR Documentation

Project a Vector onto Non-Negative Non-Increasing Space

Description

Applies an isotonic regression-style projection to enforce that the output vector is non-negative and non-increasing. Used internally by predict.orthoMTL to ensure survival predictions are monotonically decreasing across time thresholds.

Usage

nnmaxheap_C(m)

Arguments

m

A numeric vector to project.

Details

This function implements a pool-adjacent-violators style algorithm. It replaces the external Iso package dependency used in the predecessor orthopen package.

Value

A numeric vector of the same length as m, projected onto the non-negative non-increasing constraint space.

Examples

# Project a vector onto the non-negative non-increasing space
nnmaxheap_C(c(3, 1, 2, -1))

# Already valid input: returned unchanged
nnmaxheap_C(c(5, 3, 3, 1))

orthoMTL documentation built on Aug. 23, 2026, 5:10 p.m.