loclin: Computing the local linear estimate (LLE).

Description Usage Arguments Details Value References See Also Examples

View source: R/OSCV_regfunctions.R

Description

Computing the LLE based on data (desx,y) over the given vector of the argument values u. The Gausssian kernel is used. See expression (3) in Savchuk and Hart (2017).

Usage

1
loclin(u, desx, y, h)

Arguments

u

numerical vector of argument values,

desx

numerical vecror of design points,

y

numerical vecror of data values (corresponding to the specified design points desx),

h

numerical bandwidth value (scalar).

Details

Computing the LLE based on the Gaussian kernel for the specified vector of the argument values u and given vectors of design points desx and the corresponding data values y.

Value

Numerical vector of the LLE values computed over the specified vector of u points.

References

See Also

OSCV_reg, h_OSCV_reg, ASE_reg, h_ASE_reg, CV_reg.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
# Example (simulated data).
n=200
dx=(1:n-0.5)/n
regf=2*dx^10*(1-dx)^2+dx^2*(1-dx)^10
u=seq(0,1,len=1000)
ydat=regf+rnorm(n,sd=0.002)
dev.new()
plot(dx,regf,'l',lty="dashed",lwd=3,xlim=c(0,1),ylim=c(1.1*min(ydat),1.1*max(ydat)),
cex.axis=1.7,cex.lab=1.7)
title(main="Function, generated data, and LLE",cex.main=1.5)
points(dx,ydat,pch=20,cex=1.5)
lines(u,loclin(u,dx,ydat,0.05),lwd=3,col="blue")
legend(0,1.1*max(ydat),legend=c("LLE based on h=0.05","true regression function"),
lwd=c(2,3),lty=c("solid","dashed"),col=c("blue","black"),cex=1.5,bty="n")
legend(0.7,0.5*min(ydat),legend="n=200",cex=1.7,bty="n")

## End(Not run)

OSCV documentation built on May 2, 2019, 6:44 a.m.

Related to loclin in OSCV...