Displaying 1 result from an estimated 1 matches for "myxh".
Did you mean:
myth
2005 Apr 14
1
LOCFIT: What's it doing?
...-------------------------------------------------
# Plain Vanilla NADARAYA-WATSON estimator (or Local Constant regression, e.g. deg=0)
# with gaussian kernel & fixed bandwidth
mkern<-function(y,x,h){
Mx <- matrix(x,nrow=length(y),ncol=length(y),byrow=TRUE)
Mxh <- (1/h)*dnorm((x-Mx)/h)
Myxh<- (1/h)*y*dnorm((x-Mx)/h)
yh <- rowMeans(Myxh)/rowMeans(Mxh)
return(yh)
}
# Generating the design Y=m(x)+e
n <- 10
h <- 0.5
x <- rnorm(n)
y <- x + rnorm(n,mean=0,sd=0.5)
# This is what I really want!
mhat <- mkern(y,x,h)
library(locfit)
yhl.raw <- locfit(y~x,alpha=c(0,h),...