R help archive: Re: [R] bivariate interpolation

Re: [R] bivariate interpolation

From: Adelchi Azzalini <azzalini_at_stat.unipd.it>
Date: Tue 03 Apr 2007 - 09:58:27 GMT

On Tue, 3 Apr 2007 11:43:55 +0200, Adelchi Azzalini wrote:

AA> On Mon, 2 Apr 2007 22:26:06 -0400, eric lee wrote:
AA> 
AA> EL> Hi.  I'm trying to take a data set with two independent and one
AA> EL> dependent variable and enter a x,y value to predict the dependent
AA> EL> with a nonparametric technique.  I've been using interpp in the akima
AA> EL> package, (windows xp, R 2.4.1), but get values that are orders of
AA> EL> magnitude off when the predictors are slightly out of the range of
AA> EL> the data set.  Can you recommend a function for me?  I've read that
AA> EL> predict.loess has the same problem or just lists NA.  Smooth.spline
AA> EL> looks good, but can only do one predictor instead of bivariate.  I've
AA> EL> tried help.search("predict"), but couldn't find what I needed.
AA> EL> Thanks.
AA> EL> 
AA> 
AA> one option is to use sm.regression of package sm, along these lines
AA> 
AA>  x <- cbind(runif(100,-2, 2), runif(100,-2, 2))
AA>  y <- x[,1]^2 + x[,2]^2 + 0.7*x[,1]*x[,2] + rnorm(100)/3
AA>  sm.regression(x,y)
AA>  ev.pt <- rbind(c(-2,-2),c(2,2), c(2,-2),c(-2,2))
AA>  a <- sm.regression(x,y, eval.points=ev.pt,  eval.grid=FALSE)

I forgot the last bit

   print(a$estimate)

-- 
Adelchi Azzalini  <azzalini@stat.unipd.it>
Dipart.Scienze Statistiche, UniversitÓ di Padova, Italia
tel. +39 049 8274147,  http://azzalini.stat.unipd.it/

______________________________________________
R-help@stat.math.ethz.ch 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.
Received on Tue Apr 03 20:20:14 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 03 Apr 2007 - 10:30:54 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.