[R] unexpected local minima/maxima with surf.gls

Pantin Florent florent_pantin at yahoo.fr
Wed Mar 20 19:33:01 CET 2013


Hi there,

I use the surf.gls() function to fit a variable measured over a surface. When I plot the predicted surface, there are local minima/maxima in almost every coordinate where data were measured, which seems aberrant. For instance:


   x <- c(343,293,343,243,293,343,443,543,593,243,293,343,393,443,493,543,593,143,193,243,293,343,393,443, 
493,543,593,193,243,293,343,543,593,643,93,193,243,293,343,393,443,493,543,43,93,143,193,243,293, 
343,393,443,493,543,593,193,243,293,343,393,443,493,543,593,643,143,193,243,293,343,443,543,593, 
643,693,143,293,393,443,493,543,593,643,243,293,343,393,493,593,643,243,343,393,243,343,393,343) 

y <- c(720,670,670,620,620,620,620,620,620,570,570,570,570,570,570,570,570,520,520,520,520,520,520,520, 
520,520,520,470,470,470,470,470,470,470,420,420,420,420,420,420,420,420,420,370,370,370,370,370,370, 
370,370,370,370,370,370,320,320,320,320,320,320,320,320,320,320,270,270,270,270,270,270,270,270,270, 
270,220,220,220,220,220,220,220,220,170,170,170,170,170,170,170,120,120,120,70,70,70,20) 

z <- c(0.66,0.66,0.66,0.66,0.66,0.66,0.67,0.66,0.66,0.66,0.66,0.66,0.67,0.67,0.66,0.66,0.66,0.66,0.66,0.66,0.66, 
0.69,0.67,0.67,0.66,0.66,0.66,0.67,0.67,0.66,0.69,0.66,0.66,0.66,0.66,0.67,0.67,0.67,0.78,0.74,0.74,0.68, 
0.68,0.66,0.66,0.66,0.66,0.66,0.72,0.72,0.83,0.70,0.66,0.66,0.66,0.67,0.67,0.67,0.67,0.74,0.70,0.70,0.66, 
0.66,0.66,0.67,0.67,0.67,0.67,0.67,0.67,0.66,0.66,0.66,0.66,0.67,0.67,0.66,0.67,0.67,0.66,0.66,0.66,0.66, 
0.66,0.66,0.66,0.67,0.66,0.66,0.66,0.66,0.66,0.66,0.66,0.66,0.66) 

dat <- data.frame(x, y, z) 

kr <- surf.gls(2, expcov, dat, d = 0.7, nx = 1000) 

prsurf <- prmat(kr, min(x), max(x), min(y), max(y), 500) 

image(prsurf, col = rainbow(1000))


One can see that local maxima/minima are found where data were measured:

points(x, y, cex = 2)


The surface I obtain can be visualised here:

http://nsa34.casimages.com/img/2013/03/16/130316115621267122.png


Thanks for your help,


Florent Pantin



John Innes Centre
Norwich
UK




More information about the R-help mailing list