Skip to contents

Climate products (WorldClim, CHELSA, regional atlases, reanalyses) are built with different station networks, interpolation methods and periods, and they disagree most where stations are sparse: mountains, deserts, high latitudes. Models fitted with different products can differ, and some algorithms are more sensitive to the choice than others (Rodriguez-Rey & Jimenez-Valverde 2024). This function shows that exposure before a product is chosen: it samples two or more products at the occurrence records and at a random sample of cells of the calibration area M, and reports, for every variable and every product against a reference:

  • agreement: Lin's concordance correlation (CCC; Lin 1989), which is 1 only when the values are identical. It falls with scatter and with any offset or change of scale.

  • correlation: Pearson and Spearman, as in the comparisons of Rodriguez-Rey & Jimenez-Valverde (2024). A high correlation with a low CCC means the products rank sites alike but differ in level or scale.

  • systematic offset: the mean difference (product minus reference), in the variable's units and in standard deviations of the reference across M, and the RMSE.

  • distributions: the distribution-free overlapping index of Pastore & Calcagni (2019), the area shared by the two densities of values (1 = the same distribution), and the share of the reference's range that the product's range covers (at the records and in M). Both were used by Rodriguez-Rey & Jimenez-Valverde (2024).

  • collinearity structure: the Mantel correlation between the two products' matrices of correlations among the variables, with a permutation test (as in Jimenez-Valverde et al. 2009 and Rodriguez-Rey & Jimenez-Valverde 2024). A low value means variable selection on one product does not carry over to the other.

  • geographic pattern: the standardised difference at every point, its rank correlation with longitude and latitude, and whether the records sit where the products disagree more than they do on average across M. plot_climate_sources() maps it.

Usage

climate_source_compare(
  sources,
  records = NULL,
  m = NULL,
  reference = 1,
  variables = NULL,
  harmonize = TRUE,
  n = 5000,
  n_perm = 999,
  coords = NULL,
  points_crs = "EPSG:4326",
  seed = 1
)

Arguments

sources

A named list of two or more climate products, each a SpatRaster (or a vector of file paths) with one layer per variable.

records

Occurrence records: data frame with coordinates, CSV path, sf or SpatVector. Optional; without them only M is compared.

m

Calibration area (sf, SpatVector, file path or an m_area). If NULL, the extent of the reference product.

reference

Name or position of the reference product in sources (e.g. a regional atlas or the product used so far).

variables

Variables to compare (after harmonising names). Default: all variables present in every product.

harmonize

Match bioclimatic layer names across naming schemes?

n

Number of cells of M sampled.

n_perm

Permutations for the Mantel test (0 to skip).

coords

Coordinate columns of records (guessed if NULL).

points_crs

CRS of the record coordinates.

seed

Random seed for the sample of M and the permutations.

Value

An object of class climate_source_compare: a list with metrics (one row per variable, product and domain, "records" or "M"), exposure (one row per variable: the lowest agreement among the products and its grade), collinearity (Mantel r and p per product), geography (per variable and product: rank correlations of the standardised difference with longitude and latitude, and the ratio of the mean absolute difference at the records to that across M), points (the values of every product at every point, with domain, lon and lat) and settings.

Details

The function is generic: any rasters with matching variables can be compared. Layers named after bioclimatic variables in the usual ways (bio1, bio_01, wc2.1_30s_bio_1, CHELSA_bio1_1981-2010_V.2.1) are matched automatically when harmonize = TRUE; other layers must have the same names in every product. Products need not share a grid or CRS: each is read at the same points with terra::extract(), so only those cells are read, even from global 30 arc-second layers.

Check that the products use the same units and scale (degrees C vs kelvin, or values multiplied by 10) before comparing: an offset larger than three standard deviations is reported as a likely mismatch.

Status. Adapted: the measures come from Rodriguez-Rey & Jimenez- Valverde (2024), Lin (1989) and Pastore & Calcagni (2019); their combination, the map of disagreement and the grading are preENM's.

References

Jimenez-Valverde, A., Nakazawa, Y., Lira-Noriega, A., Peterson, A.T. (2009) Environmental correlation structure and ecological niche model projections. Biodiversity Informatics 6, 28-35. doi:10.17161/bi.v6i1.1634

Lin, L.I-K. (1989) A concordance correlation coefficient to evaluate reproducibility. Biometrics 45, 255-268. doi:10.2307/2532051

McBride, G.B. (2005) A proposal for strength-of-agreement criteria for Lin's concordance correlation coefficient. NIWA Client Report HAM2005-062. National Institute of Water & Atmospheric Research, Hamilton, New Zealand.

Pastore, M., Calcagni, A. (2019) Measuring distribution similarities between samples: a distribution-free overlapping index. Frontiers in Psychology 10, 1089. doi:10.3389/fpsyg.2019.01089

Rodriguez-Rey, M., Jimenez-Valverde, A. (2024) Differing sensitivity of species distribution modelling algorithms to climate data source. Ecological Informatics 79, 102387. doi:10.1016/j.ecoinf.2023.102387

See also

plot_climate_sources(), write_climate_sources(); climate_indices() to compute the same indices from each product's monthly layers.

Examples

sim <- simulate_enm_data(seed = 1, n_presence = 80)
a <- sim$env
# a second "product": a regional bias in the north-east, plus noise
b <- a
x <- terra::init(a[[1]], "x")
y <- terra::init(a[[1]], "y")
bump <- exp(-((x - 22)^2 + (y - 54)^2) / 2)
set.seed(1)
noise <- terra::init(a[[1]], fun = stats::rnorm)
b[[1]] <- a[[1]] + 0.3 * bump + 0.03 * noise
b[[2]] <- a[[2]] * 1.1 + 0.02 * noise
cs <- climate_source_compare(list(A = a, B = b), sim$presence, n = 2000)
cs
#> Comparison of 2 climate products against A: 2 variable(s), 80 records, 2000 cells of M
#> 
#> IN SHORT
#> - The products agree well at the records for every variable (CCC at least
#>   0.95): the choice of product should matter little for these variables.
#> - Part of M differs by more than 0.5 SD: env1 in B (8% of cells). Where
#>   these cells lie is shown by plot_climate_sources(x, "map").
#> - The disagreement follows a geographic gradient for env2 in B: see
#>   plot_climate_sources(x, "map").
#> 
#>  variable worst_source  ccc    r offset_sd       grade unit_mismatch
#>      env1            B 0.97 0.98      0.05 substantial         FALSE
#>      env2            B 0.97 1.00      0.15 substantial         FALSE
#> 
#> CCC = Lin's concordance correlation of the product with A at the records (1
#> = identical values; it falls with scatter, offset and change of scale);
#> grade after McBride (2005): poor below 0.90, moderate 0.90-0.95,
#> substantial 0.95-0.99, almost perfect above 0.99, limits from the
#> literature. offset_sd = mean difference (product - reference) in standard
#> deviations of the reference across M; offsets above 0.25 SD, differences
#> above 0.5 SD in more than 5% of M, Mantel r below 0.8 and a records-to-M
#> disagreement ratio above 1.5 are preENM defaults, not from the literature.
#> All metrics, per domain, in x$metrics; the geographic pattern in
#> x$geography.
#> 
#> A preENM sensitivity analysis: how much the result depends on the climate
#> data product. The others are listed in ?sensitivity_analyses.
plot_climate_sources(cs)

plot_climate_sources(cs, "map")