surf.gls               package:spatial               R Documentation

Fits a Trend Surface by Generalized Least-squares

Description:

     Fits a trend surface by generalized least-squares.

Usage:

     surf.gls(np, covmod, x, y, z, nx = 1000, ...)

Arguments:

      np: degree of polynomial surface 

  covmod: function to evaluate covariance or correlation function 

       x: x coordinates or a data frame with columns 'x', 'y', 'z' 

       y: y coordinates 

       z: z coordinates. Will supersede 'x$z' 

      nx: Number of bins for table of the covariance. Increasing adds
          accuracy, and increases size of the object. 

     ...: parameters for 'covmod' 

Value:

     list with components

    beta: the coefficients 

       x: 

       y: 

       z: and others for internal use only. 

References:

     Ripley, B. D. (1981) _Spatial Statistics._ Wiley.

     Venables, W. N. and Ripley, B. D. (2002) _Modern Applied
     Statistics with S._ Fourth edition.  Springer.

See Also:

     'trmat', 'surf.ls', 'prmat', 'semat', 'expcov', 'gaucov',
     'sphercov'

Examples:

     library(MASS)  # for eqscplot
     data(topo, package="MASS")
     topo.kr <- surf.gls(2, expcov, topo, d=0.7)
     trsurf <- trmat(topo.kr, 0, 6.5, 0, 6.5, 50)
     eqscplot(trsurf, type = "n")
     contour(trsurf, add = TRUE)

     prsurf <- prmat(topo.kr, 0, 6.5, 0, 6.5, 50)
     contour(prsurf, levels=seq(700, 925, 25))
     sesurf <- semat(topo.kr, 0, 6.5, 0, 6.5, 30)
     eqscplot(sesurf, type = "n")
     contour(sesurf, levels = c(22, 25), add = TRUE)

