Learn R Programming

fields (version 8.3-6)

vgram: Traditional or robust variogram methods for spatial data

Description

vgram computes pairwise squared differences as a function of distance. Returns an S3 object of class "vgram" with either raw values or statistics from binning. crossCoVGram is the same as vgram but differences are taken across different variables rather than the same variable. plot.vgram and boxplotVGram create lineplots and boxplots of vgram objects output by the vgram function.

Usage

vgram(loc, y, id = NULL, d = NULL, lon.lat = FALSE, 
                    dmax = NULL, N = NULL, breaks = NULL, 
                    type=c("variogram", "covariogram", "correlogram"))

crossCoVGram(loc1, loc2, y1, y2, id = NULL, d = NULL, lon.lat = FALSE, dmax = NULL, N = NULL, breaks = NULL, type=c("cross-covariogram", "cross-correlogram"))

boxplotVGram(x, N=10, breaks = pretty(x$d, N, eps.correct = 1), plot=TRUE, ...)

## S3 method for class 'vgram': plot(x, N=10, breaks = pretty(x$d, N, eps.correct = 1), add=FALSE, ...)

Arguments

Value

vgram and crossCoVGram return a "vgram" object containing the following values:vgramVariogram or covariogram valuesdPairwise distancescallCalling stringstatsMatrix of statistics for values in each bin. Rows are the summaries returned by the stats function or describe. If not either breaks or N arguments are not supplied then this component is not computed.centersBin centers.If boxplotVGram is called with plot=FALSE, it returns a list with the same components as returned by bplot.xy

References

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

See Also

vgram.matrix, bplot.xy, bplot

Examples

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

look<-vgram( x,y, N=15, lon.lat=TRUE) # locations are in lon/lat so use right
#distance
# 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

boxplotVGram(look, breaks=brk)
plot(look, add=TRUE, breaks=brk, col=4)

#
# compute equivalent covariogram, but leave out the boxplots
#
look<-vgram( x,y, N=15, lon.lat=TRUE, type="covariogram")
plot(look, breaks=brk, col=4)

#
# compute equivalent cross-covariogram of the data with itself 
#(it should look almost exactly the same as the covariogram of 
#the original data, except with a few more points in the 
#smallest distance boxplot and many points plotted twice)
#
look = crossCoVGram(x, x, y, y, N=15, lon.lat=TRUE, type="cross-covariogram")
plot(look, breaks=brk, col=4)

Run the code above in your browser using DataLab