Isotonic regression



In statistics and numerical analysis, isotonic regression or monotonic regression is the technique of fitting a free-form line to a sequence of observations such that the fitted line is non-decreasing (or non-increasing) everywhere, and lies as close to the observations as possible.

Applications
Isotonic regression has applications in statistical inference. For example, one might use it to fit an isotonic curve to the means of some set of experimental results when an increase in those means according to some particular ordering is expected. A benefit of isotonic regression is that it is not constrained by any functional form, such as the linearity imposed by linear regression, as long as the function is monotonic increasing.

Another application is nonmetric multidimensional scaling, where a low-dimensional embedding for data points is sought such that order of distances between points in the embedding matches order of dissimilarity between points. Isotonic regression is used iteratively to fit ideal distances to preserve relative dissimilarity order.

Isotonic regression is also used in probabilistic classification to calibrate the predicted probabilities of supervised machine learning models.

Isotonic regression for the simply ordered case with univariate $$x, y$$ has been applied to estimating continuous dose-response relationships in fields such as anesthesiology and toxicology. Narrowly speaking, isotonic regression only provides point estimates at observed values of $$x.$$ Estimation of the complete dose-response curve without any additional assumptions is usually done via linear interpolation between the point estimates.

Software for computing isotone (monotonic) regression has been developed for R, Stata, and Python.

Problem statement and algorithms
Let $$(x_1,y_1),\ldots,(x_n,y_n)$$ be a given set of observations, where the $$y_i \in \mathbb{R}$$ and the $$x_i$$ fall in some partially ordered set. For generality, each observation $$(x_i,y_i)$$ may be given a weight $$w_i \ge 0$$, although commonly $$w_i=1$$ for all $$i$$.

Isotonic regression seeks a weighted least-squares fit $$\hat{y}_i \approx y_i$$ for all $$i$$, subject to the constraint that $$\hat{y}_i \le \hat{y}_j$$ whenever $$x_i \le x_j$$. This gives the following quadratic program (QP) in the variables $$\hat{y}_1, \ldots, \hat{y}_n$$:


 * $$\min \sum_{i=1}^n w_i (\hat{y}_i - y_i)^2$$ subject to $$\hat{y}_i \le \hat{y}_j \text{ for all } (i,j) \in E$$

where $$E = \{(i,j): x_i \le x_j\}$$ specifies the partial ordering of the observed inputs $$x_i$$ (and may be regarded as the set of edges of some directed acyclic graph (dag) with vertices $$1,2,\ldots n$$). Problems of this form may be solved by generic quadratic programming techniques.

In the usual setting where the $$x_i$$ values fall in a totally ordered set such as $$\mathbb{R}$$, we may assume WLOG that the observations have been sorted so that $$x_1 \le x_2 \le \cdots \le x_n$$, and take $$E = \{(i,i+1): 1 \le i < n\}$$. In this case, a simple iterative algorithm for solving the quadratic program is the pool adjacent violators algorithm. Conversely, Best and Chakravarti studied the problem as an active set identification problem, and proposed a primal algorithm. These two algorithms can be seen as each other's dual, and both have a computational complexity of $$O(n)$$ on already sorted data.

To complete the isotonic regression task, we may then choose any non-decreasing function $$f(x)$$ such that $$f(x_i) = \hat{y}_i$$ for all i. Any such function obviously solves
 * $$\min_f \sum_{i=1}^n w_i (f(x_i) - y_i)^2$$ subject to $$f$$ being nondecreasing

and can be used to predict the $$y$$ values for new values of $$x$$. A common choice when $$x_i \in \mathbb{R}$$ would be to interpolate linearly between the points $$(x_i,\hat{y}_i)$$, as illustrated in the figure, yielding a continuous piecewise linear function:
 * $$f(x) = \begin{cases}

\hat{y}_1 & \text{if } x \le x_1 \\ \hat{y}_i + \frac{x-x_i}{x_{i+1}-x_i}(\hat{y}_{i+1}-\hat{y}_i) & \text{if } x_i \le x \le x_{i+1} \\ \hat{y}_n & \text{if } x \ge x_n \end{cases}$$

Centered isotonic regression
As this article's first figure shows, in the presence of monotonicity violations the resulting interpolated curve will have flat (constant) intervals. In dose-response applications it is usually known that $$f(x)$$ is not only monotone but also smooth. The flat intervals are incompatible with $$f(x)$$'s assumed shape, and can be shown to be biased. A simple improvement for such applications, named centered isotonic regression (CIR), was developed by Oron and Flournoy and shown to substantially reduce estimation error for both dose-response and dose-finding applications. Both CIR and the standard isotonic regression for the univariate, simply ordered case, are implemented in the R package "cir". This package also provides analytical confidence-interval estimates.