Why Examine Expression Across Distance?
A spatial expression map shows where measurements were collected, but a map alone does not summarize how expression differences change with separation. An empirical variogram does: it groups pairs of spots by their distance and summarizes the squared expression differences within each group. This makes it possible to ask whether nearby spots tend to have more similar measurements than distant spots, and over what spatial scale that pattern is apparent.
The variogram describes the spatial structure of the measured spot-level quantity. Its interpretation depends on what that quantity is—for example, a transformed expression measurement or a model residual—and it does not by itself identify a biological cause. In particular, a spatial spot can contain a mixture of cells, as in the earlier material on spatial mixtures. A variogram of spot-level expression is therefore not automatically a description of expression variation within a single cell type.
Definition and Empirical Construction
Let \(Y(s_i)\) be the expression measurement at spot \(i\), located at coordinate \(s_i\). Coordinates may be two-dimensional, such as \((x_i,y_i)\), and distances must be expressed in a stated coordinate unit, such as millimetres. The measurement scale must also be stated: if \(Y\) is log expression, the variogram is in squared log-expression units.
This definition commonly relies on intrinsic stationarity: increments have mean zero, and the variance of an increment depends on the separation vector, not on where the pair lies. Under second-order stationarity, the mean is constant and the covariance depends only on separation; in that case, \(\gamma(h)=C(0)-C(h)\), where \(C(h)\) is the covariance at lag \(h\). These assumptions are working descriptions, not properties guaranteed by a spatial dataset. A strong unmodelled spatial trend or changing variability across tissue regions can make a single variogram difficult to interpret.
For an omnidirectional empirical variogram, define a distance bin \(B_k\), with lower and upper distance limits, and let \(N_k\) be the set of unordered spot pairs whose separation falls in that bin. If \(m_k\) is the number of pairs in \(N_k\), the estimator is:
Each pair contributes half its squared difference; the estimator averages those contributions across the \(m_k\) pairs. A bin with no pairs has no empirical estimate. The bin centre is often used as the plotted distance, but the bin boundaries and pair count should also be retained: a wide bin can combine substantially different distances, while a bin with very few pairs can be unstable.
Worked Calculations and Interpretation
Worked Example: Calculating Directional Semivariance
Suppose four hypothetical spots have coordinates in millimetres and expression measurements in arbitrary units: \((0,0)\) has value 10, \((1,0)\) has value 14, \((0,1)\) has value 20, and \((1,1)\) has value 24. Consider pairs at distance 1 mm. The two horizontal pairs have differences \(14-10=4\) and \(24-20=4\). The horizontal directional semivariance is:
Thus, the estimate is 8 squared expression units. The two vertical pairs have differences \(20-10=10\) and \(24-14=10\), so their directional semivariance is \((10^2+10^2)/(2(2))=200/4=50\) squared expression units. The difference between these two estimates suggests that the pattern may depend on direction. With only two pairs in each direction, however, this hypothetical dataset is far too small to establish a stable directional pattern.
A useful qualitative description of a variogram often uses three terms. The nugget is the value approached as separation approaches zero; a positive nugget can reflect measurement error or variation at scales smaller than the sampling resolution. The sill is the level at which semivariance approximately levels off, when a plateau is visible. The range is the distance over which semivariance rises toward that plateau; beyond it, the variogram indicates little additional increase in dissimilarity with distance. These terms describe a pattern, not an automatic guarantee that a particular parametric model fits.
Because distinct sampled spots rarely have exactly zero separation, the empirical variogram generally cannot directly observe the value at zero distance. A first-bin estimate is an average over nonzero distances, not the nugget itself. Similarly, a visually flat tail is only an approximate sill, and the apparent range depends on the sampled distances, binning and uncertainty.
Worked Example: Reading a Rise and Plateau
For a hypothetical expression measurement, suppose four distance bins contain the squared pair differences shown below. The units of distance are millimetres; the variogram values are in squared expression units.
| Distance bin centre | Squared differences in bin | Pair count \(m_k\) | Empirical semivariance |
|---|---|---|---|
| 0.5 mm | 4, 16, 36 | 3 | 56 / 6 = 9.333 |
| 1.5 mm | 64, 100, 64 | 3 | 228 / 6 = 38.00 |
| 2.5 mm | 100, 144, 100 | 3 | 344 / 6 = 57.33 |
| 3.5 mm | 121, 100, 144 | 3 | 365 / 6 = 60.83 |
For example, at 0.5 mm the estimate is \((4+16+36)/(2\times3)=56/6=9.333\) squared expression units. At 3.5 mm it is \((121+100+144)/(2\times3)=365/6=60.83\) squared expression units. The estimates rise and then approach roughly 60 squared expression units, so a plateau around that level is plausible in this small illustration. The rise appears to level off between about 2.5 and 3.5 mm, giving a rough practical range in that region, not a precisely established cutoff.
There are no observations at distances arbitrarily close to zero, so this table does not determine the nugget. Nor does it support a formal claim that the sill equals exactly 60: each bin has only three pairs, and pair differences can be dependent because a spot can occur in multiple pairs. The interpretation is descriptive and conditional on the measured expression scale and the sampled tissue.
Direction and Uneven Spot Locations
An omnidirectional variogram pools pairs with different orientations. To examine anisotropy, restrict pairs by both distance and direction. For example, a horizontal directional bin might include pairs whose connecting line lies within a chosen angular tolerance of the horizontal axis. Since a line has no preferred arrow, orientations are conventionally treated modulo 180 degrees. The same empirical formula is then calculated using only the selected directional pairs.
Geometric anisotropy is a pattern in which spatial dependence has different scales by direction—for example, a rise toward the sill may extend farther along one tissue axis than another. Directional semivariances can also differ in magnitude. A directional plot is informative only if there are enough pairs across relevant distances and orientations. If the spot arrangement contains many horizontal pairs but few vertical pairs, a jagged or missing vertical variogram may reflect sampling geometry rather than a genuine biological difference.
Worked Example: Sparse Pairs in an Irregular Layout
Suppose an irregularly sampled hypothetical section yields two pairs in a short-distance bin, with expression differences 2 and 4, but only one pair in a more distant bin, with difference 10. The first estimate is \((2^2+4^2)/(2\times2)=(4+16)/4=5\) squared expression units. The second is \(10^2/(2\times1)=50\) squared expression units.
The large second estimate is based on just one pair. It could indicate increasing dissimilarity, but it could also be driven by that pair’s locations, tissue region, or an unusual measurement. Pooling all three pairs would give \((4+16+100)/(2\times3)=120/6=20\) squared expression units, but that pooled number would no longer describe either distance bin. The appropriate response is to report pair counts and locations, examine the map and directional coverage, and avoid treating the single-pair estimate as a reliable plateau or range.
Diagnostics, Alternatives, and Limitations
Before interpreting a variogram, check that its shape is not an artefact of preprocessing or design. Confirm that coordinates use a consistent metric and unit, that each unordered pair is counted once, and that bins cover distances actually supported by the sample. Inspect pair counts by bin and direction; abrupt oscillations in bins with few pairs are a warning. Plot the expression values and coordinates as well: a broad spatial trend or distinct tissue regions can make semivariance rise with distance even when the intended interpretation concerns local dependence. If the mean structure is not approximately stable, the variogram of raw measurements may mix trend with residual spatial variation.
Irregular sampling changes which pairs are available at each distance and orientation. The empirical formula weights each observed pair equally, so areas with dense sampling can contribute many more pairs. That does not make the estimate a uniform summary of all tissue locations. Pair reuse also means that pairs are not generally independent, so pair count alone is not a standard error or a formal measure of precision. Variograms are descriptive summaries; uncertainty assessment requires methods that account for the sampling design and dependence.
A variogram and Moran’s I answer related but different descriptive questions. Moran’s I summarizes spatial association through a chosen neighborhood or weights structure, whereas a variogram displays how squared differences vary across distance bins and can be examined directionally. Neither summary establishes a causal mechanism, and the variogram does not by itself provide a significance test. Unlike a fitted spatial model, an empirical variogram is not a complete probability model for the measurements. Its limitations include sensitivity to bin choices, sparse distances, trend, measurement scale and spot composition.
Constructing and Checking a Variogram
A practical workflow keeps the choices visible rather than hiding them behind a plot. The plotted curve is an estimate assembled from spot pairs, so interpretation should return to the underlying coordinates and measurements whenever the pattern is surprising.
Name the expression scale, coordinate system and distance units; check for a mean trend that would make a stationary-increments interpretation implausible.
For each unordered spot pair, calculate distance and squared difference, then assign it to a predeclared distance bin. Record the pair count in every bin.
Compute half the average squared difference per bin. Plot estimates with pair counts, inspect directional subsets when justified, and flag sparse bins and irregular orientation coverage.
Describe a rise, possible plateau, and possible directional differences only at the scales supported by the observations. Treat nugget, sill and range as approximate pattern features, not precisely identified facts.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A distance bin contains two spot pairs with expression differences 3 and 5. What is its empirical semivariance, and in what units?
- A variogram rises through 2 mm and is roughly flat from 4 mm onward. What can be said about its sill and range, and what cannot be concluded from this description alone?
- Why might a directional variogram based on one pair per bin be misleading even if its estimates change consistently with distance?
- What does a positive first-bin semivariance establish about the nugget?
Solutions. (1) \((3^2+5^2)/(2\times2)=(9+25)/4=8.5\) squared expression units. (2) The tail suggests a possible sill at the level of the flat estimates and a practical range around the distance where it levels off, roughly 4 mm in this description. Without the estimate values, pair counts, uncertainty and broader sampling information, the sill and range cannot be quantified reliably or treated as exact. (3) One pair can dominate each estimate, and changes can reflect specific locations or tissue regions rather than a stable directional distance pattern; pair reuse and sparse orientation coverage also limit interpretation. (4) It establishes only that the average squared difference for pairs in that positive-distance bin is nonzero. It does not directly identify the limiting semivariance at zero distance, so it does not by itself determine the nugget.