vgram {fields}R Documentation

Finds a traditional or robust variogram for spatial data.


Computes pairwise squared differences as a function of distance. Returns either raw values or statistics from binning.


vgram(loc, y, id=NULL, d=NULL,, dmax=NULL, N=NULL, breaks=NULL)


loc Matrix where each row is the coordinates of an observed point of the field
y Value of the field at locations
id A 2 column matrix that specifies which variogram differnces to find. If omitted all possible pairing are found. This can used if the data has an additional covariate that determines proximity, for example a time window.
d Distances among pairs indexed by id. If not included distances from from directly from loc. If true, locations are assumed to be longitudes and latitudes and distances found are great circle distances ( in miles see Default is false.
dmax Maximum distance to compute variogram.
N Number of bins to use.
breaks Bin boundaries for binning variogram values. Need not be equally spaced but must be ordered.


A list with these components.


Bin centers


See any standard reference on spatial statistics. For example Cressie, Spatial Statistics

See Also

vgram.matrix bplot.xy, vgram.matrix


# compute variogram for the midwest ozone field  day 16
# (BTW this looks a bit strange!)
data( ozone2)
good<- !$y[16,])
x<- ozone2$[good,] 
y<- ozone2$y[16,good]

look<-vgram( x,y, N=15, # locations are in lon/lat so use right
# take a look:
#plot( look$d, look$vgram)
#lines(look$centers, look$stats["mean",], col=4)

brk<- seq( 0, 250,,25)
## or some boxplot bin summaries

bplot.xy( look$d, sqrt(look$vgram), breaks=brk,ylab="sqrt(VG)")
lines(look$centers, look$stats["mean",], col=4)

[Package fields version 3.3.1 Index]