isoreg
Isotonic / Monotone Regression

Description

Computes isotonic least square regression.

Usage

isoreg(x, y = NULL)
## S3 method for class 'isoreg':
print(x, digits = getOption("digits"), ...) 
## S3 method for class 'isoreg':
as.stepfun(x, ...)
## S3 method for class 'isoreg':
fitted(object, ...)
## S3 method for class 'isoreg':
residuals(object, ...)

Arguments

x, y numeric predictor and response vectors, respectively. The inputs x and y will be processed by xy.coords so they may be in the form of a list (whose components are named x and y), a two-column matrix, a ts (time series) object, or a complex vector. If y is missing then x is used as y and seq_along(x) is used as x. See xy.coords for more details.

No NAs are allowed.

In print.isoreg and as.stepfun.isoreg, x is an object of class "isoreg", as returned by the isoreg() function.

digits the number of significant digits that should be printed.
... other optional argument pass to or from print method. The other methods that accept ... silently ignore them.

Details

isoreg function fits the isotonic (non-decreasing) function with the minimum sum of squared residuals at the given data points. This is a piecewise constant function and is fit using the 'pool-adjacent-violators' algorithm.
print.isoreg is a method of the generic function print for class "isoreg". It prints out all components of an "isoreg" object in special format.
Value
isoreg returns a list object of class "isoreg" with following components:

x the input predictor values.
y the input response values.
yf the fitted values corresponding to ordered x values
yc the cumulative sums of y values corresponding to ordered x values.
iKnots an integer vector giving the indices (into the sorted x) of breakpoints in the step function.
isOrd logical value which is TRUE if the input x is in sorted order and FALSE if it is unsorted.
ord if isOrd is TRUE, the indices such that x[ord] is in sorted order. Otherwise NULL.
call matched call.
as.stepfun.isoreg returns a function of class "stepfun" that may used to make predictions with.
fitted.isoreg returns the fitted values of the isotonic regression and residuals.isoreg returns the residuals.
References
Barlow, R. E., et al. 1972. Statistical Inference Under Order Restrictions. London, UK: Wiley.
Robertson, T., Wright, F. T., and Dykstra, R. L. 1988. Order Restricted Statistical Inference.
See Also
xy.coords, as.stepfun
Examples
x <- c(101, 103, 107, 107, 110, 111)
y <- c( 33,  34,  33,  36,  34,  37)
irFit <- isoreg(x, y)
irFit
sum(residuals(irFit)^2)
as.stepfun(irFit)(seq(100, 112, by=1/2)) # prediction
Package stats version 6.0.0-69
Package Index