Learn R Programming

fields (version 5.02)

vgram: Finds a traditional or robust variogram for spatial data.

Description

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

Usage

vgram(loc, y, id=NULL, d=NULL, lon.lat=FALSE, dmax=NULL, N=NULL, breaks=NULL)

Arguments

Value

A list with these components.vgramVariogram 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.

References

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

See Also

vgram.matrix bplot.xy, vgram.matrix

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

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

Run the code above in your browser using DataLab