lps.variance {bda}R Documentation

compute the variance of the local polynomial regression function

Description

To compute the variance of the local polynomial regression function

Usage

  lps.variance(y,x,bw, method="Rice")

Arguments

y,x

Two numerical vectors: y is the response and x is the predictor.

bw

Smoothing parameter. Is used only when method='Wasserman' or method='heteroscedastic'.

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: Rice.

Value

the variance of r(x).

Examples


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)

 

[Package bda version 15.2.2 Index]