Heterra

Part 5 · Model evaluation · Chapter 9

SIE

Spatial information explained

The question

How much of the spatial information in my variable does each prediction model explain, beyond what R² tells me?

You need

One point table with the observed y, one field of out-of-fold predictions per model, two coordinate fields and, if you have it, the fold of each point.

You get

E for every model with its fold standard error, E at each grid scale, and R² with its fold standard error, in one figure and three tables.

1The method

The idea

A variable has spatial information when knowing where a point lies tells you something about its value. Mutual information measures this: I(y; S) is the information shared between the value y and the location S. If a model has explained the spatial structure of y, its residuals should no longer depend on location, so the mutual information between the residuals e and S should be small. SIE is the share of the spatial information of y that is no longer in the residuals:

Er = 1 − I(e; S) / I(y; S)
y and the residuals e = y − prediction are each cut into nb equal-frequency bins. The location S is the cell of a grid of g × g cells laid over the bounding box of the points. Er is limited to the range 0 to 1.
E = sum over the grid scales of wg Er, with softmax weights wg of I(y; S)

Er is computed at several grid scales (4, 6, 8 and 10 cells a side by default) and the scales are combined into one value E, with more weight on the scales at which y carries more spatial information. A higher E means that the model explains more of the spatial structure of y.

Two panels of R squared against SIE for ten models predicting C4 grass cover across Australia: spatial block cross-validation on the left, random cross-validation on the right
SIE beside R², in the paper's case study. Ten models that predict C4 grass cover across Australia, drawn again with the paper's code and data. Each point is a model, with E on the horizontal axis and R² on the vertical axis; the bars are one fold standard error. The left panel uses spatial block cross-validation, as the example of this chapter does. The right panel uses random cross-validation, which gives every model a higher E. Source: Song (2026), case study.

One E, and its error bars

ValueComputed fromColumn
EAll points at once (the pooled estimate). There is one E per model.E
Standard error of EE computed in each fold separately; the standard deviation of those values divided by √k, for k foldsE_se
R²The mean of the fold R², each 1 − SSE/SST, with its fold standard errorR2, R2_se
R² on all points1 − SSE/SST over all pointsR2_pooled

The fold values are used only for the error bars. E itself is not their mean.

When to use it

Where it has been used

FieldResponse ySpatial unitStudy
VegetationShare of area under C4 natural grass0.5° grid cellSong (2026)

Any spatial prediction with a continuous response fits, for example soil properties, air quality, vegetation cover, land surface temperature or urban indicators, and any model, because SIE reads only the predictions.

Keep in mindSIE needs out-of-fold predictions: each point predicted by a model that did not see it. In-sample predictions overstate E. A difference in E between two models that is smaller than their fold standard errors is not evidence that one is better.

2In Heterra

2.1 Prepare your data

Heterra does not fit the models. You build them in your own software and bring one table of predictions. To make that table:

  1. Assign every point to one of k folds. Spatial block cross-validation, in which each fold is made of whole spatial blocks, is the usual choice for spatial data.
  2. For each fold in turn, fit the model on the other folds and predict the points of the fold that was left out.
  3. Put the predictions together, so that every point has one prediction, made by a model that did not see it. Do this for every model, with the same folds.
  4. Write one row per point: the two coordinates, the observed y, the fold, and one field of predictions per model.

Save the table as CSV, shapefile, GeoPackage or GeoJSON (Part 1 shows how to add data). Since version 1.6.0 the layer may also be polygons or a regular grid; the location of each row is still the pair of coordinate fields you choose (for a layer with geometry, Geometry X and Geometry Y are offered too).

FieldTypeIn the example
Observed yNumberC4_grass, C4 grass cover (%)
Predictions, one field per modelNumbers, out-of-foldrandom_forest, xgboost, lightgbm, svr, neural_net, elastic_net, lasso, gbm, knn, mars
X and Y coordinatesNumbers, degrees or metreslon, lat
Fold (optional)Number or categoryfold, 1 to 5
Boundary (optional)A polygon layersie_boundary: the states and territories drawn on the map and on the maps of the local SIE. It changes no result.

The field names are the model names. The example is not simulated: it is the case of the paper, 2480 grid cells across Australia with the out-of-fold predictions of ten models under five-fold spatial block cross-validation. The boundary comes from the Australian Bureau of Statistics (Australian Statistical Geography Standard), simplified by the author; 2 cell centres lie just beyond its simplified coast.

2.2 Run the example, step by step

Open the tool from the Toolbox (Model evaluation → SIE), click Tutorial, then Load Example. The grid cells and the boundary appear on the map, and the panel on the right is filled in for you.

Heterra after Load Example: the 2480 grid cells across Australia and the SIE panel at step 1
After Load Example: the layers on the left, the grid cells on the map, the SIE panel on the right at step 1 of 3.

The panel has three steps. Next moves on; Run appears at the last step, because only that step computes.

  1. SIE panel, step 1 DataDataChoose the layer and the Observed y: C4_grass. Under Predictions tick the ten model fields.
  2. SIE panel, step 2 Location and foldsLocation and foldsCoordinates lon and lat; Fold fold, which gives the error bars. The Study-area boundary (for the maps) is optional.
  3. SIE panel, step 3 ParametersParametersKeep 20 bins and grid scales 4, 6, 8, 10, as in the paper. Click Run.

The run takes about one second. The Chart page opens with the figure, and the panel lists every result under Outputs: the three tables, the figure, and since version 1.6.0 the local SIE fields and their figure of maps. A green line says that the results match the reference results computed with R.

Heterra after the SIE run: the figure with three panels on the Chart page and the results in the panel
After Run: the figure SIE of the prediction models. The Outputs list in the panel opens the tables and the maps of the local SIE.

2.3 With your own data

  1. Add your table (Add Data), open SIE from the Toolbox, choose the layer and y, and tick one prediction field per model.
  2. In step 2 choose the two coordinate fields and, if you have one, the fold field.
  3. Start with the default parameters (20 bins, grid scales 4, 6, 8, 10).

3Reading the results

The run draws one figure with three panels and one legend of the prediction models. Read panel a first (how do the models rank on E?), then panel b (at which scales?), and then panel c (does E agree with R²?). The tables hold the same numbers. A second figure, new in version 1.6.0, maps a local SIE (section 3.4).

SIE of the prediction models: a, bars of E by model; b, E at grid scales 4 to 10, one line per model; c, mean fold R squared against E with error bars
SIE of the prediction models: a, SIE by model; b, Multi-scale SIE; c, SIE and R². Error bars are ± one fold standard error (SD/√k), in c of E (horizontal) and of R² (vertical).

3.1 Panel a: SIE by model

What it shows. E of each model, largest at the top, with its fold standard error. The table SIE and R² by model lists the values:

ModelESE of ER² (mean of folds)SE of R²R² on all points
knn0.5010.0220.7270.0070.755
neural_net0.5010.0120.7510.0060.775
xgboost0.5000.0110.7290.0150.755
svr0.4850.0330.7890.0240.794
lightgbm0.4770.0180.7140.0180.737
gbm0.4690.0190.7510.0120.774
random_forest0.4590.0140.7620.0130.777
mars0.3680.0260.7260.0100.760
elastic_net0.3350.0290.6960.0220.727
lasso0.3330.0290.6960.0220.726

How to read it. The bar is the pooled E, computed from all points. The error bar is the fold standard error; it says how much E varies between folds, and it is the yardstick for comparing models. The top three models (0.501, 0.501, 0.500) cannot be told apart: their differences are far smaller than their standard errors. The gap between the upper group and mars, elastic_net and lasso (0.33 to 0.37) is several standard errors wide. The table E and R² by fold gives the fold values behind the error bars; for knn they run from 0.247 to 0.362, all below the pooled 0.501, which is why E is not reported as a mean of folds.

In a paper

"Spatial information explained (SIE; Song 2026) was computed from out-of-fold predictions under five-fold spatial block cross-validation, with 20 bins and grid scales 4, 6, 8 and 10. E is the estimate from all observations and is reported with its fold standard error. KNN, the neural network and XGBoost explain the most spatial information (E = 0.50, SE 0.01 to 0.02) and cannot be separated; the lasso and the elastic net explain the least (E = 0.33, SE 0.03)."

3.2 Panel b: Multi-scale SIE

What it shows. Er at each grid scale, one line per model. The table Scale profile adds, for each scale, the number of occupied cells, the two mutual informations (I_Y_S, I_e_S), a bias term of the mutual information estimate (reported only, not subtracted) and the weight of the scale in E.

Grid scale gOccupied cellsI(y; S)WeightEr of knnEr of lasso
4150.6700.1990.6150.436
6290.8290.2340.5680.421
8490.9710.2690.4950.311
10721.0710.2980.3790.215

How to read it. The first four columns describe y and the grid, so they are the same for every model. In the example every line falls from left to right: the models explain more of the broad pattern (4 × 4 cells) than of the finer pattern (10 × 10 cells). Lines that cross show models that are better at different scales, which the single value E hides. An Er of 0 can also mean that the residuals carry more spatial information than y (I_e_S larger than I_Y_S in the table). The bias term grows with the number of cells (from 0.054 at g = 4 to 0.272 at g = 10 here), so do not add very fine grids to a small data set.

In a paper

"For every model the spatial information explained decreases with finer grids: for KNN from 0.61 at 4 × 4 cells to 0.38 at 10 × 10 cells, and for the lasso from 0.44 to 0.22."

3.3 Panel c: SIE and R²

What it shows. One point per model: E on the horizontal axis and the mean fold R² on the vertical axis, each with its fold standard error. R² is always 1 − SSE/SST. Without a fold field the vertical axis is R² on all points and there are no error bars; the column R2_pooled is always R² on all points.

How to read it. R² measures how close the predicted values are; E measures how much spatial information the predictions explain. The two rank the models differently. Here SVR has the highest R² (0.789), while KNN and the neural network have the highest E (0.501). Models with similar R² can differ clearly in E: mars and knn have almost the same R² (0.726 and 0.727) but E of 0.368 and 0.501. Read both error bars before you call a model better: where the crosses of two models overlap in a direction, the models are not separated in that measure.

In a paper

"R² and SIE rank the models differently. SVR has the highest cross-validated R² (0.79 ± 0.02, mean ± fold standard error), whereas KNN and the neural network explain the most spatial information (E = 0.50). MARS and KNN have nearly the same R² (0.73) but differ in E (0.37 ± 0.03 against 0.50 ± 0.02)."

Export the figure from the Chart page as PDF or SVG (vector) or PNG at 300 dpi; Data CSV saves the numbers behind it. Export results in the panel writes a report of the run with the method, the steps, the figure and the tables (Part 1).

3.4 Local SIE (new in version 1.6.0)

Ten maps of Australia, one per model, the grid cells coloured by local SIE from 0 (blue) to 1 (red), with the state boundaries
Maps of the local SIE: one map per model on one colour scale from 0 (blue) to 1 (red). The title of each map names the grid scale g that was used.

What it shows. E computed again around every grid cell. For each model one scale is used: of the grid scales of the run, the one whose E is nearest the model's multi-scale E (in the example g = 8 for all ten models). The window of a cell is the cell and the cells around it, 3 × 3. In the window y and the residuals are binned again and E = 1 − I(e; S) / I(y; S) is computed as in the whole area, with fewer bins, because a window has far fewer observations. A window with fewer than 30 observations has no value; in the example all 49 cells with observations have one. The run adds a copy of the layer with one field per model, sie_local_<model>: every observation carries the value of its cell.

ModelMedian local SIELargest local SIE
xgboost0.4790.773
neural_net0.4630.813
lightgbm0.4550.791
knn0.4400.813
svr0.4320.817
gbm0.4320.756
random_forest0.3640.737
mars0.2900.781
elastic_net0.2750.635
lasso0.2630.646

How to read it. Compare the same region across the maps. All ten models explain the most spatial information in the west of the continent and the least along the south coast, where several cells are at 0. The linear models (elastic_net, lasso) and mars are low over a wider part of the south and the north than the tree and kernel models. The medians, computed from the fields over the 2480 observations, are not the E of panel a: windows overlap, use one scale and fewer bins, and each is limited to 0 to 1.

Block and random cross-validation. A run has one set of predictions, so it draws one map per model. To compare the two kinds of cross-validation, run SIE a second time with the predictions made under random cross-validation; both runs stay in History. The example holds block cross-validation predictions only.

How far to trust itThe local SIE is an addition of Heterra 1.6.0. It is not defined in Song (2026), there is no R reference for it, and its numbers are therefore not checked against R as the tables are. Use it to explore where the models differ, and report the scale g and the 3 × 3 window with every local number. The report of a run does not yet include the local values.

In a paper

"A local SIE was computed for each grid cell at g = 8 from the observations of the cell and its eight neighbours (Heterra 1.6.0). All models explain most spatial information in the west of the continent and least along the south coast (Figure X)."

3.5 Reading the results together

The three panels tell one story: how much spatial information each model explains (panel a), at which scales (panel b), and whether that agrees with accuracy (panel c). SIE is useful when it separates models that R² does not. Read them in this order:

  1. Table Scale profile: check that the bias term at the finest grid is still small next to I(y; S).
  2. Panel a: SIE by model: the ranking by E, and which gaps are larger than the fold standard errors.
  3. Panel b: Multi-scale SIE: how much spatial information each model leaves, scale by scale.
  4. Panel c: SIE and R²: where each model lies on the two axes.
  5. Maps of the local SIE: where on the map the models differ, as an exploration after the three panels.

What SIE is notIt is not a measure of accuracy. Noise without spatial structure in the predictions can also weaken the link between residuals and location, while the accuracy gets worse. Read E together with R² from the same validation, never alone. E is a relative reduction of mutual information, not a share of a fixed total.

3.6 From the results to a manuscript

SectionWhat to writeFrom Heterra
MethodsSpatial information as I(y; S); the out-of-fold residuals and how the folds were made; the number of bins, the grid scales and the bias term; the softmax weights, which depend on y onlyThe settings of the run (in the exported report); table Scale profile
ResultsE of each model with its fold standard error; the scale profile of at least the leading models; E against R², and which models lead on which axisFigure SIE of the prediction models; tables SIE and R² by model and Scale profile
DiscussionWhy mutual information sees structure that an average error hides; whether the ranking holds with other bins and grid scales; the limits of the estimatePanel c of the figure; a second run with other parameters. A comparison with random cross-validation needs a second set of predictions, made outside Heterra
Common pitfalls
  • Random cross-validation overstates E, because nearby points are in both the training and the test set. In the paper's case it raised E for all ten models, by 2.1 to 17.0% (Song 2026). Use spatial blocks.
  • Fix the bins and the grid scales before you look at the models. Do not choose the scale at which your preferred model looks best.
  • E values can be compared only when the bins, the grid scales and the points are the same. Report E with these settings.
  • Do not use a grid so fine that the bias term is more than about a quarter of I(y; S).

4Exercises

Exercises 1 to 3 use the example. Exercise 4 is for your own data.

Exercise 1Read

Run the example with its settings. Which model has the highest E, and which the highest mean fold R²? In the Scale profile table, which model has the highest Er at grid scale 10?

Answer

knn has the highest E (0.501, with neural_net at 0.501 and xgboost at 0.500 next to it). svr has the highest mean fold R² (0.789). At g = 10 the highest Er is xgboost's (0.396), ahead of neural_net (0.391) and knn (0.379): the order at one scale is not the order of E.

Exercise 2Explore

Open the table E and R² by fold from the Outputs list. Which fold has the most points? What are E and R² of svr in that fold, and in fold 2? What does this tell you about svr's error bars in panel c?

Answer

Fold 5 has 592 points. In it svr has E = 0.409 and R² = 0.872; in fold 2 (441 points) E = 0.220 and R² = 0.748. svr varies more between folds than any other model, so it has the widest error bars in both directions (SE of E 0.033, SE of R² 0.024).

Exercise 3Interpret

A colleague writes: "KNN captures the spatial structure of C4 grass cover better than XGBoost and far better than the lasso, because its E is the highest." Check this against the SIE table. Which half of the sentence is justified?

Answer

Only the second half. E of knn (0.501, SE 0.022) and of xgboost (0.500, SE 0.011) differ by much less than either standard error, so the data do not separate them. The lasso (0.333, SE 0.029) is lower by several standard errors, so that difference can be reported.

Exercise 4Your data

Fit at least two models to your own data under cross-validation in the software you normally use, build the table of section 2.1 and run SIE. Write three sentences for a results section: one on the ranking by E with the standard errors, one on how E changes with the grid scale, and one comparing the ranking by E with the ranking by R². Export the figure as PDF.

Checklist

Is every prediction out-of-fold, and were all models given the same folds? Did you say how the folds were made, and give nb and the grid scales? Are the differences you report larger than the fold standard errors? Did you say which R² you report (mean of folds or all points)? Does each sentence give a number?

References

Heterra guide, for version 1.6.0. © 2026 Yongze Song. Documentation and tutorial data: CC BY 4.0.