locPolWeights: Local Polynomial Weights

locCteWeightsR 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 (p).

kernel

Kernel used to perform the estimation, see Kernels

weig

Vector of weights for observations.

lpweig

Local polynomial weights (X^TWX)^{-1}X^TW evaluated at xeval matrix.

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 (n*h*f(x))^{p+1} being h the bandwidth bw.

locWeig

(X^TWX)^{-1}X^TW evaluated at xeval Matrix.

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

Kernels, locpol.

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)

locpol documentation built on Nov. 29, 2022, 9:05 a.m.

Related to locPolWeights in locpol...