1. Home
2. MONOTONIC directive

# MONOTONIC directive

Fits an increasing monotonic regression of y on x.

### Parameters

`Y` = variates Y-values of the data points X-values of the data points; default is to assume that the x-values are monotonically increasing Variate to save the residuals from each fit Variate to save the fitted values from each fit

### Description

Monotonic regression plays a key role in non-metric multidimensional scaling, which is available in Genstat via the `MDS` directive. However, it can be useful in its own right, so the method has been made accessible by the `MONOTONIC` directive. A monotonic regression through a set of points is simply the line that best fits the points subject to the constraint that it never decreases: of course the line need not be straight, in fact it rarely will be. If you need a monotonically decreasing line, you can simply subtract all the y-values from their maximum, find the monotonically increasing regression, and then back-transform the data and fitted line, and change the sign of the residuals.

The `MONOTONIC` directive has no options. It has four parameters: `Y` to specify the y-values, `X` for the x-values, `RESIDUALS` to save the residuals, and `FITTEDVALUES` to save the fitted values. The x-values need not be supplied, in which case the directive assumes that the y-values are in increasing order of the x-values. In common with the other regression directives, the variates to save the residuals and fitted values need not be declared in advance.

Options: none.

Parameters: `Y`, `X`, `RESIDUALS`, `FITTEDVALUES`.

### Action with `RESTRICT`

`MONOTONIC` ignores any restrictions on the variates.

Directives: `MDS`, `FIT`, `FITCURVE`, `FITNONLINEAR`.

Commands for: Multivariate and cluster analysis, Regression analysis.

### Example

```" Example 1:4.5.2 "
VARIATE [VALUES=2,6,4,4, 9,1,12,15,13,18] X
&       [VALUES=1,5,3,6,10,0,11,14,16,18] Y
MONOTONIC Y=Y; X=X; FITTED=Fvals
LPGRAPH [TITLE='Monotonic regression'; NROWS=25; NCOLUMNS=61]\
Fvals,Y; X; METHOD=line,point
SORT X,Y
MONOTONIC Y; RESIDUALS=Res; FITTED=Fvals
PRINT X,Y,Fvals,Res
```
Updated on March 7, 2019