locCteWeights | R Documentation |
Local Constant and local Linear estimator with weight.
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)
x |
x covariate data values. |
y |
y response data values. |
xeval |
Vector with evaluation points. |
bw |
Smoothing parameter, bandwidth. |
deg |
Local polynomial estimation degree (p). |
kernel |
Kernel used to perform the estimation, see |
weig |
Vector of weights for observations. |
lpweig |
Local polynomial weights (X^TWX)^{-1}X^TW evaluated at |
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
locCteWeightsC
and locLinWeightsC
returns a list
with two components
den |
Estimation of (n*h*f(x))^{p+1} being h the
bandwidth |
locWeig |
(X^TWX)^{-1}X^TW evaluated at |
Jorge Luis Ojeda Cabrera.
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).
Kernels
, locpol.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.