search for: getpredictor

Displaying 2 results from an estimated 2 matches for "getpredictor".

2006 Apr 05
1
predict.smooth.spline.fit and Recall() (Was: Re: Return function from function and Recall())
...tion. > > Now, I run into a problem calling a returned function that down the > stream uses Recall(). Below is a self-contained example. I took away > yesterday's code for returning a minimal environment for the function, > because that is not related to this problem. > > getPredictor <- function(x, y) { > sp <- smooth.spline(x=x, y=y, keep.data=FALSE) > function(x, ...) predict(sp$fit, x, ...)$y > } > > # Simulate data > x <- 1:10 > y <- 1:10 + rnorm(length(x)) > > # Estimate predictor function > fcn <- getPredictor(x,y) > &gt...
2006 Apr 05
0
Return function from function and Recall()
...to return a function from a function. Now, I run into a problem calling a returned function that down the stream uses Recall(). Below is a self-contained example. I took away yesterday's code for returning a minimal environment for the function, because that is not related to this problem. getPredictor <- function(x, y) { sp <- smooth.spline(x=x, y=y, keep.data=FALSE) function(x, ...) predict(sp$fit, x, ...)$y } # Simulate data x <- 1:10 y <- 1:10 + rnorm(length(x)) # Estimate predictor function fcn <- getPredictor(x,y) # No extrapolation => no Recall() ypred <- fcn(x)...