Isotonic regression

From HandWiki
Short description: Type of numerical analysis
An example of isotonic regression (solid red line) compared to linear regression on the same data, both fit to minimize the mean squared error. The free-form property of isotonic regression means the line can be steeper where the data are steeper; the isotonicity constraint means the line does not decrease.

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.


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,[1] 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.[2]

Isotonic regression for the simply ordered case with univariate [math]\displaystyle{ x, y }[/math] 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 [math]\displaystyle{ x. }[/math] Estimation of the complete dose-response curve without any additional assumptions is usually done via linear interpolation between the point estimates. [3]

Software for computing isotone (monotonic) regression has been developed for R,[4][5][6] Stata, and Python.[7]

Problem statement and algorithms

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

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

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

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

In the usual setting where the [math]\displaystyle{ x_i }[/math] values fall in a totally ordered set such as [math]\displaystyle{ \mathbb{R} }[/math], we may assume WLOG that the observations have been sorted so that [math]\displaystyle{ x_1 \le x_2 \le \cdots \le x_n }[/math], and take [math]\displaystyle{ E = \{(i,i+1): 1 \le i \lt n\} }[/math]. In this case, a simple iterative algorithm for solving the quadratic program is the pool adjacent violators algorithm. Conversely, Best and Chakravarti[8] 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 [math]\displaystyle{ O(n) }[/math] on already sorted data.[8]

To complete the isotonic regression task, we may then choose any non-decreasing function [math]\displaystyle{ f(x) }[/math] such that [math]\displaystyle{ f(x_i) = \hat{y}_i }[/math] for all i. Any such function obviously solves

[math]\displaystyle{ \min_f \sum_{i=1}^n w_i (f(x_i) - y_i)^2 }[/math] subject to [math]\displaystyle{ f }[/math] being nondecreasing

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

[math]\displaystyle{ 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} }[/math]

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 [math]\displaystyle{ f(x) }[/math] is not only monotone but also smooth. The flat intervals are incompatible with [math]\displaystyle{ f(x) }[/math]'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.[9] Both CIR and the standard isotonic regression for the univariate, simply ordered case, are implemented in the R package "cir".[4] This package also provides analytical confidence-interval estimates.


  1. Kruskal, J. B. (1964). "Nonmetric Multidimensional Scaling: A numerical method". Psychometrika 29 (2): 115–129. doi:10.1007/BF02289694. 
  2. (in EN) Predicting good probabilities with supervised learning | Proceedings of the 22nd international conference on Machine learning. doi:10.1145/1102351.1102430. Retrieved 2020-07-07. 
  3. Stylianou, MP; Flournoy, N (2002). "Dose finding using the biased coin up-and-down design and isotonic regression". Biometrics 58 (1): 171–177. doi:10.1111/j.0006-341x.2002.00171.x. PMID 11890313. 
  4. 4.0 4.1 Oron, Assaf. "Package 'cir'". R Foundation for Statistical Computing. 
  5. Leeuw, Jan de; Hornik, Kurt; Mair, Patrick (2009). "Isotone Optimization in R: Pool-Adjacent-Violators Algorithm (PAVA) and Active Set Methods". Journal of Statistical Software 32 (5): 1–24. doi:10.18637/jss.v032.i05. ISSN 1548-7660. 
  6. Xu, Zhipeng; Sun, Chenkai; Karunakaran, Aman. "Package UniIsoRegression". R Foundation for Statistical Computing. 
  7. Pedregosa, Fabian (2011). "Scikit-learn:Machine learning in Python". Journal of Machine Learning Research 12: 2825–2830. Bibcode2011JMLR...12.2825P. 
  8. 8.0 8.1 Best, Michael J.; Chakravarti, Nilotpal (1990). "Active set algorithms for isotonic regression; A unifying framework". Mathematical Programming 47 (1–3): 425–439. doi:10.1007/bf01580873. ISSN 0025-5610. 
  9. Oron, AP; Flournoy, N (2017). "Centered Isotonic Regression: Point and Interval Estimation for Dose-Response Studies". Statistics in Biopharmaceutical Research 9 (3): 258–267. doi:10.1080/19466315.2017.1286256. 

Further reading

  • Robertson, T.; Wright, F. T.; Dykstra, R. L. (1988). Order restricted statistical inference. New York: Wiley. ISBN 978-0-471-91787-8. 
  • Barlow, R. E.; Bartholomew, D. J.; Bremner, J. M.; Brunk, H. D. (1972). Statistical inference under order restrictions; the theory and application of isotonic regression. New York: Wiley. ISBN 978-0-471-04970-8. 
  • Shively, T.S., Sager, T.W., Walker, S.G. (2009). "A Bayesian approach to non-parametric monotone function estimation". Journal of the Royal Statistical Society, Series B 71 (1): 159–175. doi:10.1111/j.1467-9868.2008.00677.x. 
  • Wu, W. B.; Woodroofe, M.; Mentz, G. (2001). "Isotonic regression: Another look at the changepoint problem". Biometrika 88 (3): 793–804. doi:10.1093/biomet/88.3.793.