locCteWeights {locpol} | R Documentation |
Local Polynomial Weights
Description
Local Constant and local Linear estimator with weight.
Usage
locCteWeightsC(x, xeval, bw, kernel, weig = rep(1, length(x)))
locLinWeightsC(x, xeval, bw, kernel, weig = rep(1, length(x)))
locPolWeights(x, xeval, deg, bw, kernel, weig = rep(1, length(x)))
locWeightsEval(lpweig, y)
locWeightsEvalC(lpweig, y)
Arguments
x |
x covariate data values. |
y |
y response data values. |
xeval |
Vector with evaluation points. |
bw |
Smoothing parameter, bandwidth. |
deg |
Local polynomial estimation degree ( |
kernel |
Kernel used to perform the estimation, see |
weig |
Vector of weights for observations. |
lpweig |
Local polynomial weights |
Details
locCteWeightsC
and locLinWeightsC
computes local
constant and local linear weights, say any of the entries of
the vector (X^TWX)^{-1}X^TW
for p=0
and p=1
resp.
locWeightsEvalC
and locWeightsEval
computes local
the estimator for a given vector of responses y
Value
locCteWeightsC
and locLinWeightsC
returns a list
with two components
den |
Estimation of |
locWeig |
|
Author(s)
Jorge Luis Ojeda Cabrera.
References
Fan, J. and Gijbels, I. Local polynomial modelling and its applications\/. Chapman & Hall, London (1996).
Wand, M.~P. and Jones, M.~C. Kernel smoothing\/. Chapman and Hall Ltd., London (1995).
See Also
Examples
size <- 200
sigma <- 0.25
deg <- 1
kernel <- EpaK
bw <- .25
xeval <- 0:100/100
regFun <- function(x) x^3
x <- runif(size)
y <- regFun(x) + rnorm(x, sd = sigma)
d <- data.frame(x, y)
lcw <- locCteWeightsC(d$x, xeval, bw, kernel)$locWeig
lce <- locWeightsEval(lcw, y)
lceB <- locCteSmootherC(d$x, d$y, xeval, bw, kernel)$beta0
mean((lce-lceB)^2)
llw <- locLinWeightsC(d$x, xeval, bw, kernel)$locWeig
lle <- locWeightsEval(llw, y)
lleB <- locLinSmootherC(d$x, d$y, xeval, bw, kernel)$beta0
mean((lle-lleB)^2)