Learn R Programming

deamer (version 1.0)

deamerSE: Density estimation using an auxiliary sample of pure errors

Description

deamerSE performs a deconvolution estimation of the density of a noisy variable ('y') under the hypothesis of an unknown density of the noise using an auxiliary sample of pure errors ("SE" for "sample error"). Therefore, deamerSE requires two samples: one with single noisy observations and another with pure errors.

Usage

deamerSE(y, errors, grid.length = 100, from, to, na.rm = FALSE)

Arguments

y
Numeric. The vector of noisy observations.
errors
Numeric. The vector of the auxiliary sample of errors. Does not need to be the same length as 'y'.
grid.length
Numeric. Optional. The number of points of the grid the estimation is performed on. Defaults to 100.
from
Numeric. Optional. The lower bound of the grid the estimation is performed on. Defaults to min(y).
to
Numeric. Optional. The upper bound of the grid the estimation is performed on. Defaults to max(y).
na.rm
Logical. Optional. If na.rm=TRUE, NAs will be removed before estimation. Defaults to FALSE.

Value

'deamer'

Warning

deamerSE is not implemented for heteroscedastic errors.

Details

The model is $y = x + e$ where $x$ and $e$ both have unknown densities. The density of $x$ is estimated by using an independant auxiliary sample of pure errors $eps$ (argument 'errors') that will be used for computing the characteristic function of the noise. It is therefore essential to ensure that $e$ and $eps$ arise from the same distribution (generally experimentally). deamerSE will handle non-centered errors. Therefore, the input vector for argument errors does not necessarily need to be centered before estimation.

References

Comte F, Lacour C. Data-driven density estimation in the presence of additive noise with unknown distribution. Journal of the Royal Statistical Society: Series B (Statistical Methodology). 2011 Sep 1;73(4):601-27.

See Also

deamer, deamerKE, deamerRO, deamer-class

Examples

Run this code

################################################################################
# Example 1: centered errors
set.seed(23456)
n = 1000; M = 500
x <- rchisq(n,3)
b=0.5
e <- rlaplace(n, 0, b)
y <- x + e

eps <- rlaplace(M, 0, b)

est <- deamerSE(y, eps)
est

curve(dchisq(x, 3), 0, 12, lwd=2, lty=3)
lines(est, lwd=2)
lines(density(y), lwd=2, lty=4)
legend("topright", bty="n", lty=c(1,3,4), lwd=2, legend=c("deamerSE", "true density", 
       "kernel density\nof noisy obs.")) 

################################################################################
# Example 2: non-centered errors
set.seed(23456)
n = 1000; M = 500
x <- rchisq(n,3)
mu=2; b=0.5
e <- rlaplace(n, mu, b)
y <- x + e

eps <- rlaplace(M, mu, b)

est <- deamerSE(y, eps, from=0, to=12)
est

curve(dchisq(x, 3), 0, 12, lwd=2, lty=3)
lines(est, lwd=2)
lines(density(y), lwd=2, lty=4)
legend("topright", bty="n", lty=c(1,3,4), lwd=2, legend=c("deamerSE", "true density", 
       "kernel density\nof noisy obs.")) 

Run the code above in your browser using DataLab