Description Usage Arguments Details Value References See Also Examples
To compute the probability density function from data contaminated with measurement error. The measurement error type is unknown.
1 |
w |
The observed data. It is a vector of length at least 3. |
e |
Observed vector of measurement errors. |
bw |
Smoothing parameter. |
adjust |
adjust the range there the PDF is to be evaluated. By default, adjust=1. |
n |
number of points where the PDF is to be evaluated. |
from |
the starting point where the PDF is to be evaluated. |
to |
the starting point where the PDF is to be evaluated. |
cut |
used to adjust the starting end ending points where the PDF is to be evaluated. |
na.rm |
is set to FALSE by default: no NA value is allowed. |
... |
controls |
The optimal bandwidth is selected by minimizing
abs(Var(f.hat)+Var(E)-Var(Y))
.
An object of class “Decon”.
Wang, X.F. and Wang, B. (2011). Deconvolution estimation in measurement error models: The R package decon. Journal of Statistical Software, 39(10), 1-24.
DeconCdf
, DeconNpr
, DeconCPdf
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | n1 <- 1500
x1 <- rnorm(n1, sd=1)
sig1 <- .5
u1 <- ifelse(runif(n1) > 0.5, 1, -1) * rexp(n1,rate=1/sig1)
w1 <- x1+u1
## The rule-of-thumb method may not be accurate,
## you may try the bootstrap method
bw1 <- bw.dnrd(w1,sig=sig1, error="laplacian")
(f1 <- DeconPdf(w1,sig1,error='laplacian',bw=bw1, fft=TRUE))
(f2 <- npdenest(w1, u1))
# plot the results
par(mfrow=c(1,1))
plot(f1, col="red", lwd=3, lty=2, xlab="x", ylab="f(x)", main="")
lines(density(x1, from=min(w1), to=max(w1)), lwd=3, lty=1)
lines(density(w1), col="blue", lwd=3, lty=3)
lines(f2, col='red', lty=1,lwd=3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.