search for: gaussiankernel

Displaying 1 result from an estimated 1 matches for "gaussiankernel".

2010 Apr 25
1
function pointer question
...for (i in 1:n) { x_i <- data.x[-i] y_i <- data.y[-i] yhat <- fnc(x=x_i,y=y_i) score <- score + (y_i - yhat)^2 } score <- score/n return(score) } I would like to use it like this: ## ## Estimator function using Gaussian Kernel ## gaussiankernel <- function(x,y,h) { modelks <- ksmooth(x,y,kernel="normal",bandwidth=h,x.points=x) yhat <- modelks$y return(yhat) } scoreks <- loocv(data,gaussiankernel(h=0.5)) I expected this to work but it doesn't :( basically I wanted to take advantage of the named parameter...