simex.H.density: Estimating probability density function from data with... In NPsimex: Nonparametric Smoothing for contaminated data using Simulation-Extrapolation

Description

To compute the probability density function from data contaminated with heteroscedastic measurement error using SIMEX.

Usage

 ```1 2``` ```simex.H.density(W, msigma, x, from, to, n.user=128, n.lambda=50, lambda="SJ", span=8, adjust=1, na.rm = FALSE, ...) ```

Arguments

 `W` The observed data. It is a vector of length at least 10. `msigma` The standard deviation σ of measurement error. It is a vector of standard deviations having the same length as W. `x` x is user-defined grids where the PDF will be evaluated. `from` the starting point where the PDF is to be evaluated. `to` the starting point where the PDF is to be evaluated. `n.user` number of points where the PDF is to be evaluated. `n.lambda` number of points of lambda's. `lambda` Specifies the first lambda. It can be a single numeric value which has been pre-determined; or computed with the specific density bandwidth selector: 'nrd0', 'nrd', 'ucv', 'bcv', 'SJ'. `span` Specifies the span of lambda. `adjust` adjust the range there the PDF is to be evaluated. By default, adjust=1. `na.rm` is set to FALSE by default: no NA value is allowed. `...` control

Value

An object of class “NPsimex”.

Author(s)

X.F. Wang [email protected]

References

Wang, X.F., Sun, J. and Fan, Z.(2011). Deconvolution density estimation with heteroscedastic errors using SIMEX.

`simex.density`, `lambda.select`, `span.H.select`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```############### Heteroscadestic error N <- 1000 set.seed(123); X <- c(rnorm(N/2, mean=-2), rnorm(N/2,mean=2)); U <- rnorm(N,sd=1); msigma <- runif(N,min=0.3,max=0.5) W <- X + msigma*U plot.simex.density <- function(X.simex,X,...){ plot(X.simex\$x, X.simex\$y, type="l", xlab="x", ylab="density", lwd=3, lty=2, col=2,...) lines(density(X, bw="SJ"), lwd=3) } par(mfrow=c(2,2)) X.simex1 <- simex.H.density(W, msigma=msigma, adjust=1, n.lambda=50, span=1) plot.simex.density(X.simex1, X, ylim=c(0,0.25)) X.simex2 <- simex.H.density(W, msigma=msigma, adjust=1, n.lambda=50, span=3) plot.simex.density(X.simex2, X, ylim=c(0,0.25)) X.simex3 <- simex.H.density(W, msigma=msigma, adjust=1, n.lambda=50, span=8) plot.simex.density(X.simex3, X, ylim=c(0,0.25)) X.simex4 <- simex.H.density(W, msigma=msigma, adjust=1, n.lambda=50, span=35) plot.simex.density(X.simex4, X, ylim=c(0,0.25)) ```