# Distance Matrix in book does not equal to my values why?

Hello.
I find myself studying variograms from a book.
When I look at the distances between points, they don't match what the program calculates. What distance is the book calculating?

``````# Simulation of data:
OK_1<-matrix(c(0.502,0.813,0.889,0.354,0.332,0.382, 0.241,0.2,0.4,
0.491,0.603,0.604,0.5,0.45,0.845,0.671,0.81,0.6,
10.7,11.061,10.470,9.845,9.764,10.64,10.358,10.928, NA), ncol = 3,
byrow=FALSE)

colnames(OK_1)<- c("X", "Y", "Data Value")

OK<-as.data.frame(OK_1)
plot(OK\$Y~OK\$X)

library(geoR)
OK_geo<-as.geodata(OK, coords.col= 1:2,
data.col = 3, na.action = "none")

OK_geo_sinna<-as.geodata(OK, coords.col = 1:2,
data.col = 3)
u <- as.vector(dist(as.matrix(OK_geo\$coords)))
u

d<-t(dist(OK_geo\$coords))

d
# 0.33055257
# 3 0.40316002 0.07600658
# 4 0.14827340 0.47041471 0.54501468
# 5 0.17487424 0.50474746 0.57789705 0.05462600
# 6 0.37378604 0.49429242 0.56136441 0.34613437 0.39815198
# 7 0.31705047 0.57602778 0.65145453 0.20496341 0.23900209 0.22395759
# 8 0.43927782 0.64700696 0.71913629 0.34614448 0.38343709 0.18533483 0.14492067
#9 0.14928161 0.41301090 0.48901636 0.11007270 0.16469366 0.24566033 0.17413213 0.29000000

``````

The matrix from the book (page 87) is:
s0 - s1: 0.1828 ---- > my matrix: last row: 0.14928
s0 - s2 0.5056 ------> my matrix: 0.413
s0 - s3 0.5994
0.1346
0.2017
0.3013
0.2130
0.35520
0.4045
0.4942
0.1816
0.2141
0.4581
0.3882
0.53800
0.0937
0.5758
0.6179
0.6054
0.7050
0.79250
0.6680
0.7083
0.6879
0.7980
0.88140
0.0670
0.4243
0.2510
0.42380
0.4881
0.2929
0.46960
0.2742
0.22760
0.17710

The distance matrix with values from the vector u, does not be equal to what bring the book.

Another question:
How have calculated the semivariogram values of an unknown point (the point with NA)?

Reference: page 88 of SPATIAL & SPATIO-TEMPORAL GEOSTATISTICAL MODELING & KRIGING - José-María Montero - Gema Fernández-Avilés; Jorge Mateu

Thanks

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.