Description Usage Arguments Details Value References See Also Examples
To compute nonparametric regression line from data contaminated with measurement error. The measurement error type is unknown.
1 |
w,y |
The observed data |
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 18 | n <- 2000
x <- c(rnorm(n/2,2,1), rnorm(n/2, -2,1))
sig <- .8
u <- sig*rnorm(n)
w <- x+u
e <- rnorm(n, sd=0.2)
y <- x^2-2*x+e
bw1 <- bw.dboot1(w, sig)
u0 <- sig*rnorm(n/2) # typically the size of u0 is smaller than x.
m2 <- npreg(w, y, u0, from=0.9*min(x), to=0.9*max(x))
# plot the results
plot(m2, col="red", lwd=3, lty=2, xlab="x", ylab="m(x)", main="",
zero.line=FALSE)
lines(ksmooth(x,y, kernel = "normal", 2, range.x=c(0.9*min(x),0.9*max(x))),
lwd=3, lty=1)
lines(ksmooth(w,y, kernel = "normal", 2, range.x=c(0.9*min(x),0.9*max(x))),
col="blue", lwd=3, lty=3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.