[R-sig-Geo] Kriging with GRASS and R: Automatic trend detection

Dylan Beaudette debeaudette at ucdavis.edu
Mon Jun 22 17:57:19 CEST 2009

On Sunday 21 June 2009, Ebrahim Jahanshiri wrote:
> It has been long that I wanted to suggets this for automatic trend
> detection based on our previous conversations with Edzer and Anne. I
> found two ways that seem to be reasonable and have potential for
> automizing the trend detection ( I got these from my conversations
> with Margaret Oliver and Dick Bruc both prominent soil scientists):
> 1-If we fit some 2D surfaces and look at the percentage variance
> accounted for by the surface  . If it is much more than 25% then you
> have trend that needs to be dealt with for geostatistics.
> [By "fitting a surface" I think means we can use the default
> parameters for just creating a surface. i dont know if we could use
> other methods lik IDW for just checking]
> this can be done pretty well in ArcGIS but I am sure that we could
> come up with something to do it automatically and give the user the
> result...
> 2- For detecting the order, If we fit the trend by Ordinary Least
> Squares (which implies that  we assume the residuals are independent)
> we can test whether the regression coefficients differ significantly
> from 0.
>  linear trend:
> model z
> fit  x, y
> second order polynomial:
> model z
> fit x, y, xy, x2, y2
> or any other order.

Good ideas and nice to see prominent soil scientists contributing to the 

As for an approach towards automatic trend detection: we may be able to skip 
parametric specification of the trend (i.e. poly(2,3,4,5, ...)) by using some 
kind of smoother: restricted cubic splines comes to mind (see rcs() in the 
Design package). The script could then check the various elements of an RCS 
fit for a pre-defined amount of variance explained in order to suggest 


Dylan Beaudette
Soil Resource Laboratory
University of California at Davis

More information about the R-sig-Geo mailing list