I assumed (probably wrongly) that in the easiest cases the output of variog
in the geoR
package and variogram
in the sp
package would have been the same.
I have this dataset:
head(final)
lat lon elev seadist tradist samples rssi
1 60.1577 24.9111 2.392 125 15.21606 200 -58
2 60.1557 24.9214 3.195 116 15.81549 200 -55
3 60.1653 24.9221 4.604 387 15.72119 200 -70
4 60.1667 24.9165 7.355 205 15.39796 200 -62
5 60.1637 24.9166 3.648 252 15.43457 200 -73
6 60.1530 24.9258 2.733 65 16.10631 200 -57
that is made of (I guess) unprojected data, so I project them
#data projection
#convert to sp object:
coordinates(final) <- ~ lon + lat #longitude first
library(rgdal)
proj4string(final) = "+proj=longlat +datum=WGS84"
UTM <- spTransform(final, CRS=CRS("+proj=utm +zone=35V+north+ellps=WGS84+datum=WGS84"))
and produce the variogram without trend according to the gstat
library
var.notrend.sp<-variogram(rssi~1, UTM)
plot(var.notrend.sp)
trying to get the same output in geoR
I go with
UTM1<-as.data.frame(UTM)
UTM1<-cbind(UTM1[,6:7], UTM1[,1:5])
UTM1
coords<-UTM1[,1:2]
coords
var.notrend.geoR <- variog(coords=coords, data=rssi,estimator.type='classical')
plot(var.notrend.geoR)