| pava {Iso} | R Documentation |
The ``pool adjacent violators algorithm'' (PAVA) is applied to calculate the isotonic regression of a set of data, with respect to the usual increasing (or decreasing) linear ordering on the indices.
pava(y, w, decreasing=FALSE, long.out=FALSE) pava.sa(y, w, decreasing=FALSE, long.out=FALSE)
y |
Vector of data whose isotonic regression is to be calculated. |
w |
Optional vector of weights to be used for calculating a weighted isotonic regression; if w is not given, all weights are taken to equal 1. |
decreasing |
Logical scalar; should the isotonic regression be calculated with respect to decreasing (rather than increasing) order? |
long.out |
Logical argument controlling the nature of the value returned. |
The function pava() uses dynamically loading of a fortran
subroutine "pava" to effect the computations. The function pava.sa()
("sa" for "stand-alone") does all of the computations in raw R. Thus
pava.sa() could be considerably slower for large data sets.
If long.out = TRUE then the result returned consists of a list whose components are
y |
the fitted values |
w |
the final weights |
tr |
a set of indices made up of the smallest index in each level set, which thus "keeps track" of the level sets. |
If long.out = FALSE then only the vector of fitted values is returned.
Rolf Turner r.turner@auckland.ac.nz http://www.math.unb.ca
Robertson, T., Wright, F. T. and Dykstra, R. L. (1988). Order Restricted Statistical Inference. Wiley, New York.
ufit()
# Increasing order:
y <- (1:20) + rnorm(20)
ystar <- pava(y)
plot(y)
lines(ystar,type='s')
# Decreasing order:
z <- NULL
for(i in 4:8) {
z <- c(z,rep(8-i+1,i)+0.05*(0:(i-1)))
}
zstar <- pava(z,decreasing=TRUE)
plot(z)
lines(zstar,type='s')