Saku
Saku

Reputation: 13

What does "n.pairs" in Variogram mean?

I fit a model in R using the gam-function from mgcv, it looks a bit like this.

m <- gamm(y ~ s(x))

and then I plot the variogram. I expect there to be correlation with x as a spatial coordinate, and correlation within groups, so I do

Variogram(m$lme, form = ~x|Group)

however the Variogram has a column called "n.pairs", which consists of numbers that are very large.

What does these numbers represent?

For example, for the ith row with distance equal to 5, I am currently seeing 20000 n.pairs.

However, there are not 20.000 pairs of observations that 1) have an exact difference of 5 (with respect to x) and 2) come from the same group.

So, if not that, what else does that number represent?

Can't quite understand this: https://stat.ethz.ch/R-manual/R-devel/library/nlme/html/Variogram.lme.html

Upvotes: 1

Views: 155

Answers (1)

Gavin Simpson
Gavin Simpson

Reputation: 174908

The number of pairs refers to the number of pairs in that distance class, not the number of pairs with exactly distance = 5.

It is very unlikely in most spatial data sets that any two pairs of samples will be separated by exactly the same distance. Therefore the distances are binned into groups and it is the number of pairs of samples, summed over groups Group, that are within distance D_i of one another. D_i is the current distance class, which might be (0 -- 100] m say.

nlme doesn't estimate a separate variograms within Group, but it will only compute distances between samples within the levels of Group, though as mentioned above, it then sums the number of pairs of samples over the levels of Group.

Upvotes: 0

Related Questions