Skip to content
Prev 56465 / 398500 Next

Approximate a f(x,y)

Akima is "free for non-commercial use" but this may be a commercial
application. 

Your solution for 1 variable is called piecewise linear interpolation; there
are many ways to extend this to 2 variables. Piecewise linear on triangles,
for example, or piecewise bilinear. For the latter, given x=(x1,x2) and the
values at integers in f[,] compute the interpolated value as

i <- floor(x)
w <- x - i
m <- f[i[1]:(i[1]+1),i[2]:(i[2]+1)]
f1 <- c(1-w[1],w[1])%*%m
c(1-w[2],w[2])%*%f1

ie there are 4 nearest grid points and the weights are just products of the
1-variable weights.

Reid Huntsinger


-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Liaw, Andy
Sent: Wednesday, September 29, 2004 11:09 AM
To: 'Naji'; r-help at stat.math.ethz.ch
Subject: RE: [R] Approximate a f(x,y)


The `akima' package on CRAN probably would help.

HTH,
Andy
______________________________________________
R-help at 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

----------------------------------------------------------------------------
--
Notice:  This e-mail message, together with any attachments,...{{dropped}}