what: Calculate weights for deconvolution

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

Description

Routine to calculate the weights for deconvolution via weighted kernel density estimates.

Usage

1
2
w.hat(y, sigma, h, gamma,
      METHOD=c("exact", "exact.cv", "svm", "svm.cv"), K=5, verb=FALSE)

Arguments

y

the observed, contaminated data.

sigma

the standard deviation of the contaminating (normal) distribution.

h

the bandwidth to be used for the weighted kernel density estimate; if missing the bandwidth returned by bw.SJ(y, method="dpi") will be used.

gamma

the regularisation parameter to be used; either a scalar for methods "exact" and "svm", or a vector of values from which a suitable value is selected via K-fold cross-validation for methods "exact.cv" and "svm.cv".

METHOD

method to be used to solve the quadratic programming problem involved in calculating the weights; if "exact" or "exact.cv" then solveqp is used, otherwise ipop from the kernlab package is used.

K

number of folds to be used if gamma is chosen by cross-validation; defaults to 5.

verb

logical; if TRUE some progress report will be printed during cross-validation.

Value

A vector containing the weights; if gamma is chosen by cross-validation, the selected value is returned as an attribute.

Author(s)

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

Berwin A Turlach Berwin.Turlach@gmail.com

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

wkde, wkde.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  set.seed(100719)
  sig <- sqrt(29/40)  # Var(Z)/Var(X) = 0.1
  y <- rden(100, DEN=3, sigma=sig)
  gamma.ridge <- exp(seq(from=0, to=6, length=17))

  save.seed <- .Random.seed
  w1 <- w.hat(y, sigma=sig, gamma=gamma.ridge,
              METHOD="exact.cv", verb=TRUE)
  plot(y, w1, type="h")
  attributes(w1)
  .Random.seed <- save.seed
  w2 <- w.hat(y, sigma=sig, gamma=gamma.ridge,
              METHOD="svm.cv", verb=TRUE)
  plot(y, w2, type="h")
  attributes(w2)

  .Random.seed <- save.seed
  w1 <- w.hat(y, sigma=sig, gamma=gamma.ridge,
              METHOD="exact.cv", K=10, verb=TRUE)
  plot(y, w1, type="h")
  attributes(w1)
  .Random.seed <- save.seed
  w2 <- w.hat(y, sigma=sig, gamma=gamma.ridge,
              METHOD="svm.cv", K=10, verb=TRUE)
  plot(y, w2, type="h")
  attributes(w2)

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