| simpleSmoothers | R Documentation |
Computes simple kernel smoothing
simpleSmootherC(x, y, xeval, bw, kernel, weig = rep(1, length(y))) simpleSqSmootherC(x, y, xeval, bw, kernel)
x |
x covariate data values. |
y |
y response data values. |
xeval |
Vector with evaluation points. |
bw |
Smoothing parameter, bandwidth. |
kernel |
Kernel used to perform the estimation, see |
weig |
weights if they are required. |
Computes simple smoothing, that is to say: it averages y
values times kernel evaluated on x values. simpleSqSmootherC
does the average with the square of such values.
Both functions returns a data.frame with
x |
x evaluation points. |
reg |
the smoothed values at |
...
Jorge Luis Ojeda Cabrera.
PRDenEstC, Kernel characteristics
size <- 1000
x <- runif(100)
bw <- 0.125
kernel <- EpaK
xeval <- 1:9/10
y <- rep(1,100)
## x kern. aver. should give density f(x)
prDen <- PRDenEstC(x,xeval,bw,kernel)$den
ssDen <- simpleSmootherC(x,y,xeval,bw,kernel)$reg
all(abs(prDen-ssDen)<1e-15)
## x kern. aver. should be f(x)*R2(K) aprox.
s2Den <- simpleSqSmootherC(x,y,xeval,bw,kernel)$reg
summary( abs(prDen*RK(kernel)-s2Den) )
summary( abs(1*RK(kernel)-s2Den) )
## x kern. aver. should be f(x)*R2(K) aprox.
for(n in c(1000,1e4,1e5))
{
s2D <- simpleSqSmootherC(runif(n),rep(1,n),xeval,bw,kernel)$reg
cat("\n",n,"\n")
print( summary( abs(1*RK(kernel)-s2D) ) )
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.