[R] interpolation and extremum location of a surface‏

David Winsemius dwinsemius at comcast.net
Wed Jun 1 19:24:48 CEST 2011


On Jun 1, 2011, at 9:24 AM, Clement LAUZIN wrote:

>
>
> Hello,
>
> I have a x,y,z file.Z is not corresponding to a simple analytical  
> function of x and y (see below).
> I am trying to find the minimum location of this surface and the z  
> value corresponding to this location by a spline interpolation or  
> from a polynomial fit.
> I tried with the akima package but as the location of the point I am  
> looking for (the minimum) is outside of the convex hull it's not  
> giving any answer.

I do not think that is the reason akima::interp is failing. (For one  
thing the minimum is not outside the convex hull of x and y.)  Note  
that the help page says that x and y cannot be collinear but yours  
appear to be so.

 > table(ZZ$x)

4.05  4.1 4.15  4.2 4.25  4.3 4.35
    5    5    5    5    5    5    5
 > table(ZZ$y)

   60 67.5   75 82.5   90
    7    7    7    7    7

I took a shot at jittering the x and y and reapplying interpp ... and  
ended up with what appeared to be useless junk.

If you look at the data with contourplot you can see it would place   
the minimum at around z=-175 at x=4.24, y=67. However, the contourplot  
and associated help pages say there is no documentation for the  
algorithm used.

contourplot(z ~ x + y, data=ZZ, at=seq(-140, -180 , by= -0.5),  
interp=TRUE)



> If someone has any idea or any suggestion?
>
> Thank you in advance Pierre
>
>
> x    y    z
> 4.1 60 -152.1719593
> 4.1 75 -171.136801
> 4.1 90 -170.4604774
> 4.2 60 -168.7745552
> 4.2 75 -174.9667333
> 4.2 90 -172.1853334
> 4.3 60 -173.7736418
> 4.3 75 -171.6712745
> 4.3 90 -167.6662458
> 4.05 60 -137.8379387
> 4.15 60 -162.2264066
> 4.25 60 -172.4453286
> 4.35 60 -173.2123715
> 4.05 67.5 -158.8239625
> 4.1 67.5 -167.314534
> 4.15 67.5 -172.586182
> 4.2 67.5 -175.2217594
> 4.25 67.5 -175.7162683
> 4.3 67.5 -174.4890566
> 4.35 67.5 -171.8940061
> 4.05 75 -165.4388778
> 4.15 75 -174.1460392
> 4.25 75 -174.022344
> 4.35 75 -168.2149168
> 4.05 82.5 -166.4026077
> 4.1 82.5 -170.9199652
> 4.15 82.5 -172.9923449
> 4.2 82.5 -173.0803255
> 4.25 82.5 -171.5739101
> 4.3 82.5 -168.8024715
> 4.35 82.5 -165.0431276
> 4.05 90 -166.2592978
> 4.15 90 -172.2861302
> 4.25 90 -170.5383652
> 4.35 90 -163.8389615
>
> ______________________________________________
> R-help at r-project.org 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.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list