3

I am trying to calculate an Experimental-Variogram value at different lag distances, so I am using the variogramm command

variog1 <- variogram((Copper)~1,ds)

but I can't know how to specify the needed lag distance. For example I want to get a value at h=(15, 30, 45, 60)

B--rian
  • 5,578
  • 10
  • 38
  • 89
Ahmed Emam
  • 33
  • 6
  • Welcome to Stackoverflow! Please provide a bit more information - are you using [this Copper dataset](https://github.com/t-redactyl/R-graphing-tutorials/blob/master/copper-data-for-tutorial.csv)? – B--rian Dec 12 '19 at 14:30

1 Answers1

1

You can fix the lag distance in the parameter "width", or you can fix exactly the distances with the parameter "boundary". See the next example:

library(sp)
library(gstat)
cord <- data.frame(x=rnorm(50,-20,6),y=rnorm(50,40,10))
predictors <- SpatialPointsDataFrame(coords = cord, data = data.frame(val=cord$x**2+cord$y+rnorm(50,sd=0.4)),
                                     proj4string = CRS("+proj=longlat +datum=WGS84"))
vario <- variogram(object = val ~ 1,data =  predictors,width=50)
plot(vario)

vario <- variogram(object = val ~ 1,data =  predictors,width=350)
plot(vario)
vario <- variogram(object = val ~ 1,data =  predictors,boundaries=c(50,100,500,700,800)) 
plot(vario)
Santiago I. Hurtado
  • 1,113
  • 1
  • 10
  • 23