isotonic_regression: Isotonic mean regression

View source: R/modeling.R

isotonic_regressionR Documentation

Isotonic mean regression

Description

Computes isotonic mean regression for numeric responses. When covariates are supplied they determine the ordering; when omitted the responses are assumed pre-sorted (regression on the index). When weights are omitted every observation receives weight 1.

Usage

isotonic_regression(y, X = NULL, weights = NULL, decreasing = FALSE)

Arguments

y

numeric vector of response values.

X

numeric vector of covariate values, or NULL if responses are pre-sorted.

weights

numeric vector of finite, non-negative weights, at least one of which must be positive, or NULL for equal weights.

decreasing

whether the fit is decreasing in the covariate (default FALSE is increasing, TRUE is decreasing).

Value

Numeric vector of isotonic fitted means, one per observation.

Examples

isotonic_regression(c(2, 3, 1, 4, 5), X = 1:5)
isotonic_regression(c(3, 2, 4, 1), X = 1:4, weights = c(1, 2, 1, 1))
isotonic_regression(sort(c(3, 1, 2, 5)))
isotonic_regression(sort(c(2, 1, 3)), weights = c(1, 2, 1))


isodistrreg documentation built on Aug. 21, 2026, 5:16 p.m.