I was wondering if any one could explain to me how the geoR package calculates the covariance function? I mean how you would do it by hand?
library(geoR)
#suppose I have the following coordinates
X = c(60,30,20,40)
Y = c(50,20,50,50)
my_coordinates = cbind(X,Y)
print(my_coordinates)
#computing covariance
my_cov= varcov.spatial(my_coordinates,cov.model="exp", cov.pars=c(0.2,25))
print(my_cov)
And you get:
[,1] [,2] [,3] [,4]
[1,] 0.20000000 0.03664442 0.04037930 0.08986579
[2,] 0.03664442 0.20000000 0.05645288 0.05645288
[3,] 0.04037930 0.05645288 0.20000000 0.08986579
[4,] 0.08986579 0.05645288 0.08986579 0.20000000
However, one might want to do it in Matlab as well.