Hello Jan,
On Apr 26, 2010, at 8:56 AM, Jan van der Laan wrote:
> You can use the '...' for that, as in:
>
> loocv <- function(data, fnc, ...) {
> n <- length(data.x)
> score <- 0
> 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)
> }
>
> scoreks <- loocv(data,gaussiankernel, h=0.5)
It works nicely, thank you!
Best regards,
Giovanni
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.