lps.variance | R Documentation |
To compute the variance of the local polynomial regression function
lps.variance(y,x,bw, method="Rice")
y , x |
Two numerical vectors: |
bw |
Smoothing parameter. Is used only when |
method |
We use four method to compute the variance of r(x):
Method 1) Larry Wasserman–nearly unbiased. This method based on
an lps object;
Method 2) Rice 1984
Method 3) Gasser et al (1986) – a variation of method 3.
Method 4) For heteroscedastic errors. Need to estimate based on an
lpr object. Yu and Jones (2004).
Defaulty method: |
the variance of r(x).
n = 100
x=rnorm(n)
y=x^2+rnorm(n)
bw = lps.variance
par(mfrow=c(1,1))
out=lpsmooth(y,x)
#plot(out, scb=TRUE, type='l')
vrx = lps.variance(y,x)
out=lpsmooth(y,x,sd.y=sqrt(vrx), bw=0.5)
plot(y~x, pch='.')
lines(out, col=2)
x0 = seq(min(x), max(x), length=100)
y0 = x0^2
lines(y0~x0, col=4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.