I have data with associated longitudes and latitudes. How do I get a variogram for this data based on the great-circle distances between the points?
This simple example has all the data on the equator:
require(geoR)
long <- seq(-179, 180)
x <- sin(pi * long / 180) + rnorm(length(long))
V <- variog(data=x, coords=cbind(long, 0))
# variog: computing omnidirectional variogram
plot(V)
The first and last points are actually only 1 degree apart, but my naive attempt results in variog
thinking they're separated by 359 degrees.
You should use the Semi-variogram from nmle. It allows you to specify a distance matrix, which you can trivially work out for yourself.