Monolpoly {sharpData} | R Documentation |
Monotonized Local Regression
Description
Local constant and local linear regression are applied to bivariate data. The response is ‘sharpened’ or perturbed in a way to render a monotonically increasing curve estimate.
Usage
Monolpoly(x, y, h, d=1, xgrid, numgrid = 401, ...)
Arguments
x |
a vector of explanatory variable observations |
y |
binary vector of responses |
h |
bandwidth |
d |
degree, can be either 0 or 1 |
xgrid |
gridpoints on x-axis where monotonicity constraint is enforced |
numgrid |
number of equally-spaced gridpoints (if xgrid not specified) |
... |
other arguments for locpoly |
Details
Data are perturbed the smallest possible L2 distance subject to the constraint that the local linear estimate is monotonically increasing.
Value
x |
locations of function estimate evaluations |
y |
function estimate evaluations (sharpened - monotonized) |
ysharp |
sharpened responses |
Author(s)
W.J.Braun
References
Braun, W.J. and Hall, P., Data Sharpening for Nonparametric Estimation Subject to Constraints, Journal of Computational and Graphical Statistics, 2001
Examples
gridpts <- seq(1, 10, length=101)
x <- seq(1, 10, length=51)
p <- exp(-1 + .2*x)/(1 + exp(-1 + .2*x))
y <- rbinom(51, 1, p)
plot(x, y)
lines(Monolpoly(x, y, h=0.6, xgrid=gridpts))
##
plot(faithful)
with(faithful,
lines(Monolpoly(eruptions, waiting, h=0.1, d=1,
range=c(1.55,5.15))))