Library: | spatial |
See also: | SPKRsurfls SPKRsurfgls SPKRexpcov SPKRgaucov SPKRsphercov SPKRtrmat SPKRprmat SPKRsemat SPKRcorrelogram SPKRmultcontours |
Quantlet: | SPKRvariogram | |
Description: | computes spatial (semi-)variograms of spatial data or residuals. Initially, it divides the range of the data into nint bins, and computes the average squared difference for pairs with separation in each bin. It returns results only for bins with 6 or more pairs. |
Usage: | res = SPKRvariogram (krig, nint) | |
Input: | ||
krig | list, (of type "trls" or "trgls") calculated by SPKRsurfls or SPKRsurfgls | |
nint | scalar, number of bins to be used | |
Output: | ||
res | list, consisting of components xpres, ypres and cntres: | |
res.xpres | n x 1 vector, x coordinates of the variogram | |
res.ypres | n x 1 vector, y coordinates of the variogram | |
res.cntres | n x 1 vector, number of pairs averaged per bin |
; loads the spatial statistics library library("spatial") ; reads a spatial data set topo = read("topo.dat") ; calculates a polynomial regression surface of order 2 myres = SPKRsurfls(2, topo) ; calculates the correlogram, using 25 bins varres = SPKRvariogram(myres, 25) varres
A list consisting of x and y coordinates of the variogram and the number of pairs averaged per bin: Contents of varres.xpres [ 1,] 0 [ 2,] 0.34483 [ 3,] 0.68966 ... [20,] 6.5517 [21,] 6.8966 Contents of varres.ypres [ 1,] 0 [ 2,] 197.78 [ 3,] 270.09 ... [20,] 1127.3 [21,] 1135.2 Contents of varres.cntres [ 1,] 0 [ 2,] 18 [ 3,] 56 ... [20,] 17 [21,] 8