simex.density: Estimating probability density function from data with...

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

View source: R/NPsimex.R

Description

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

Usage

1
2
simex.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 single positive numeric value.

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.

See Also

simex.density, lambda.select, span.select.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
############### Homoscadestic error
N <- 1000
set.seed(123); X <- c(rnorm(N/2, mean=-2), rnorm(N/2,mean=2)); U <- rnorm(N,sd=1)
msigma <- 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.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.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.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.density(W, msigma=msigma, adjust=1, n.lambda=50, span=35)
plot.simex.density(X.simex4, X, ylim=c(0,0.25))

NPsimex documentation built on May 29, 2017, 9:06 a.m.