wkde: Weighted kernel density estimate

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/wkde.R

Description

Calculates a weighted kernel density estimate as defined by equation (5) of Hazelton and Turlach (2009).

Usage

1
wkde(y, eval, w, h)

Arguments

y

the observed values.

eval

grid on which the deconvolution density estimate is to be calculated.

w

the weights to be used.

h

the smoothing parameter to be used.

Details

If "eval" is not specified, it defaults to seq(min(y)-0.1*sd(y), max(y)+0.1*sd(y), length=100).

If "w" is not specified, it defaults to a vector of ones.

If "h" is not specified, it defaults to bw.SJ(y, method="dpi").

Value

A matrix with two columns named "x" and "y"; the first column contains the evaluation grid, "eval", and the second column the deconvolution density estimate.

Author(s)

Martin L Hazelton m.hazelton@massey.ac.nz

References

Hazelton, M.L. and Turlach, B.A. (2009). Nonparametric density deconvolution by weighted kernel estimators, Statistics and Computing 19(3): 217–228. http://dx.doi.org/10.1007/s11222-008-9086-7.

See Also

w.hat, wkde.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
  set.seed(100719)
  sig <- sqrt(29/40)  # Var(Z)/Var(X) = 0.1
  y <- rden(100, DEN=3, sigma=sig)
  f.hat <- wkde(y)
  plot(f.hat, type="l", ylim=c(0, 0.2))
  w <- w.hat(y, sigma=sig, gamma=2.05) 
  fd.hat <- wkde(y, w=w)
  lines(fd.hat, col="red")
  w <- w.hat(y, sigma=sig, gamma=4.4)
  fd.hat <- wkde(y, w=w)
  lines(fd.hat, col="blue")

DeconWK documentation built on May 2, 2019, 6:08 p.m.