[R-sig-Geo] Non-symmetric variogram map in gstat
Edzer J. Pebesma
e.pebesma at geo.uu.nl
Wed Jul 18 11:19:13 CEST 2007
David, you may also notice that the map produced does not have a cell
centre or cell 'crossing' at (0,0). Of course you'd assume enough
cleverness that this would be enforced automatically, but too bad. Try
v <- variogram(Ni ~ 1, jura.pred, cutoff=1.8, width=0.18, map=T)
(making sure that the cutoff is a multiple of the width) and you'll see
something symmetric.
Best wishes,
--
Edzer
David Rossiter wrote:
> I've found a quite puzzling behaviour in gstat's variogram method, with
> the map=T argument. I believe the result should be a symmetric map
> because all the semivariances are squared differences. This is indeed
> the case if I try an example from the Meuse set:
>
>
>> library(gstat)
>> data(meuse)
>> coordinates(meuse) <- ~x + y
>> class(meuse)
>>
> [1] "SpatialPointsDataFrame"
> attr(,"package")
> [1] "sp"
>
>> v <- variogram(log(lead) ~ 1, meuse, cutoff=1000, width=200, map=T)
>> plot(v)
>> # symmetric plot as expected, confirm by looking at array
>> v$map at data$var1
>>
> [1] 0.241586 0.875118 1.329685 0.978228 0.877734 0.854946 0.628017
> 0.356488 0.323171 0.299103 0.389137
> ...
> [111] 0.387982 0.302654 0.319343 0.356488 0.630622 0.862242 0.877734
> 0.978228 1.329685 0.875118 0.241586
>
>> # and the number of pairs:
>> v$map at data$np.var1
>>
> [1] 2 10 13 36 44 63 86 137 141 122 123 3 7 26 53 60
> 92 123 150 156 123 87 4 12 41 61
> ...
> [105] 92 61 53 26 7 3 122 122 143 137 87 64 44 36 13 10
> 2
>
> BUT ... when I try with the Jura dataset I get non-symmetric results:
>
>
>> data(jura)
>> coordinates(jura.pred) <- ~Xloc + Yloc
>> class(jura.pred)
>>
> [1] "SpatialPointsDataFrame"
> attr(,"package")
> [1] "sp"
>
>> v <- variogram(Ni ~ 1, jura.pred, cutoff=1.2, width=0.18, map=T)
>> plot(v)
>>
> # not symmetric! Confirm with array:
>
>> v$map at data$var1
>>
> [1] 89.5503 59.3319 88.4276 79.4282 75.1518 147.6931 55.4805
> 43.6888 70.5159 86.9107 59.5392
> ...
> [188] 105.4008 48.2219 72.3849 35.7244 66.7842 62.4743 72.9742
> 72.6469 70.9808
>
>> # and the number of pairs
>> v$map at data$np.var1
>>
> [1] 42 78 54 97 124 39 159 82 92 62 79 70 93 68 114 78
> 177 86 92 72 59 82 192 95 192 79
> ...
> [183] 73 135 72 72 97 101 76 137 39 111 105 132 94 31
>
> Clearly both the number of pairs and the resulting average semivariance
> are not symmetric!
>
> Both of the objects are converted to SpatialPointsDataFrames. I can see
> no obvious reason for this discrepency.
>
> D G Rossiter
> Senior University Lecturer
> Department of Earth Systems Analysis (DESA)
> International Institute for Geo-Information Science and Earth
> Observation (ITC)
> mailto:rossiter at itc.nl, Internet: http://www.itc.nl/personal/rossiter
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
More information about the R-sig-Geo
mailing list