FAQ/iso - CBU statistics Wiki
location: FAQ / iso

Isotonic regression and an alternative nonparametric trend test plus a parametric version

There are two nonparametric methods which test to see if a single response is ordered with respect to groups which have an assumed apriori ordering.

Isotonic regression finds the best fitting model which has an unknown number of changepoints (also called 'knots') separating linear fits. An alternative nonparametric approach, the Jonckheere-Terpstra test, compares the ordering in the groups to that which would be expected by chance.

Both these tests may be fitted in the statistical package, R, using code here. The specific code of interest is listed here. The more recent ISOREG procedure in R will also perform an isotonic regression. In either case a p-value is produced to assess whether the groups form an ordering with respect to the observed response. The basic isotonic regression model fitted in R pools means of responses at particular time points until they form a strictly increasing set of means with respect to the categories. The least squares fit from these poolings is then compared to that using the grand (overall) mean (and hence no changepoints) to assess the improvement in fit.

Jonckheere's trend test is also fitted in the analyse>nonparametric tests procedure in SPSS. Further details of Jonckheere's Trend Test with an example, are also given.

There is also a parametric version which fits linear regression lines and finds the minimum residual sums of squares to determine the location of a fixed number of changepoints. R code for one and two changepoint examples are given here.

Howell (2013, p.646-9) illustrates a related issue allowing the fitting of separate slopes and intercepts for baseline and intervention trials on each of four single cases using a standard regression analysis of phase (baseline or intervention), trial number and phase by trial interaction.

In addition a comprehensive suite of changepoint programs with R code are illustrated here (or here if the link is not working) in a pdf file. The programs obtain locations of changepoints using information functions which minimize lack of fit using likelihood functions which assume different distributions of the data and use a penalty function which favours models with smaller numbers of changepoints. A selection of references is also given in the pdf file for further reading. Such a penalty function is needed for example using the residual sum of squares for Normally distributed data which would trivially reduce as more changepoints are added.


Howell, D.C. (2013). Statistical methods for psychology. 8th Edition. International Edition. Wadsworth:Belmont,CA.

Kashlak, A. (2019). A wonderful night for Oscar speeches. Significance 16(1) 24-27. R code (using the cpt.meanvar routine in the changepoint library by Killick and Eckley (2014)) used in this article is available from the author's website at bit.ly/2AUL3Yw. This assesses location of changepoints dividing time points into groups having different means.

Killick, R. and Eckley, I. (2014). changepoint:An R package for changepoint analysis. Journal of Statistical Software 58(3) 1-19.

SPSS Version 3 reference manual. To be confirmed.

Tan, X., Shiyko, M.P. and Li, R. (2012). A time-varying effect model for intensive longitudinal data. Psychological Methods 17(1) 61-77. SAS macro and other code for fitting models with an unknown numbers of changepoints allowing for quadratic change.

Zou, C., Yin, G., Feng, L. and Wang, Z. (2014). Nonparametric maximum likelihood approach to multiple change-point problems. Annals of Statistics 42(3) 970-1002. A nonparametric approach to detecting change over time. Illustation in Haynes K. (2016) The Fitbit generation: from couch potato to marathon runner. Significance 13(1) 24-25 (See pdf copy here).

None: FAQ/iso (last edited 2019-03-18 09:45:49 by PeterWatson)