Description Usage Arguments Details Value Note Author(s) References See Also Examples
Calculates the hat matrix, L, used to obtain fitted values for given loess smoothing parameters, for an equally-spaced design 1, ..., n
. Also allows extrapolation beyond the design points.
1 2 3 4 5 6 |
n |
number of equally-spaced design points, assigned values |
x |
object of class |
span |
number of design points to be used in the local neighborhood – must be odd. |
degree |
degree of local polynomial (currently can be either 0, 1, or 2). |
blend |
the amount of blending to degree 0 smoothing at the endpoints. |
at |
which rows of the operator matrix to calculate. |
stats |
whether or not to calculate auxiliary statistics. |
If all that is desired is the loess estimate, it is more efficient and flexible to use the built-in loess()
. The main purpose of this function is its use in stlOp or subsequent smoothings after using stlOp()
.
A list of class "op"
.
O |
the operator matrix of dimension |
at |
at as specified in |
span |
span as specified in |
deg |
deg as specified in |
var |
the squared l2 norm of each row in O – used in variance calculations. |
stats |
only if |
This requires o(n^2) storage and computation. Rows of the operator matrix corresponding to interior design points will be identical, so keep this in mind.
Ryan Hafen
W. S. Cleveland, E. Grosse and W. M. Shyu (1992) Local regression models. Chapter 8 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | n <- 200
L <- loessOp(n, span=91, degree=2, at=c(-9:(n+10)))
plotVar(L)
plotOp(L)
## get fitted values for some data
x <- c(1:n)
# generate some data
y <- sin(x*2*pi/n) + rnorm(x, sd=0.5)
# get the fitted values
yhat <- predict(L, y)
# another way: yhat <- L$O %*% y
plot(x, y, xlim=range(L$at))
lines(L$at, yhat, col="red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.