Geographically Weighted Principal Component Analysis (GWPCA)

Statistics
Introduced by
Paul Harris, Chris Brunsdon & Martin Charlton
Year
2011
Type
Local dimensionality reduction
Family
Local spatial models

What does it do?

Geographically Weighted Principal Component Analysis (GWPCA) is a local dimensionality-reduction method introduced by Harris, Brunsdon, and Charlton in 2011.

It extends classical PCA by fitting a separate weighted PCA at each location, so the principal components and their loadings can vary across geographic space rather than being summarised by one global solution. It is relevant when a researcher suspects that the multivariate structure of the data differs from place to place.

The intuition behind the method

Imagine running a standard PCA on your dataset, but giving observations near a focal location more weight than distant ones, and repeating this independently for every location on your map. The result is a surface of eigenvectors and eigenvalues: at each location you learn which linear combinations of the variables capture the most variance locally. If the principal components are similar everywhere, the global PCA is a reasonable summary; if they shift across the study area, spatial variation in the multivariate structure is present, and GWPCA makes it visible.

History

GWPCA was introduced by Harris, Brunsdon, and Charlton in a 2011 article in the International Journal of Geographical Information Science. The article moves from global PCA to a locally weighted PCA for exploring subsets of attribute space, and then to GWPCA, and illustrates the method with a study of social structure in Greater Dublin, Ireland. The geographically weighted framework used for regression is described on the related page.

When to use it

Use GWPCA when you have georeferenced multivariate data and suspect that the main patterns of covariation differ across the study area, for example if the variables that dominate in urban zones differ from those in rural zones. The source article notes that standard PCA can be replaced with GWPCA when spatial heterogeneity is of interest. It also describes adapting PCA to account for spatial autocorrelation, or for a mixture of both effects. Do not use it for non-spatial tabular data, where no spatial kernel can be defined, or when the number of effective observations within the kernel at a location is too small to estimate a covariance matrix for all the variables; check these counts before mapping results. If spatial variation in the structure is not of interest, global PCA is simpler. If the goal is prediction rather than describing structure, Geographically Weighted Regression may be more appropriate.

Limitations and considerations

  • A full eigendecomposition is computed at every calibration location, so computation grows with the number of locations and variables
  • Local eigenvectors are defined only up to a sign change, so loadings must be aligned before they are compared across locations
  • Results depend on the kernel and bandwidth choice, and bandwidth tuning is itself an estimation step that affects the output
  • When local structures vary strongly, no single summary loading matrix describes the study area, which makes the results harder to report

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Reveals spatial non-stationarity in multivariate structure that a global PCA would average away
  • Produces maps of local eigenvalues and loadings for each variable and component, which can be inspected directly for spatial patterns
  • Does not require a predefined spatial model, because the spatial structure enters only through the kernel weights
  • Bandwidth can be chosen from the data by cross-validation or AIC rather than fixed by the analyst

Applications

  • Environmental monitoring: mapping which air-quality variables co-vary locally to identify pollution regimes across a region
  • Public health: identifying spatially varying dimensions of socioeconomic deprivation associated with health outcomes
  • Social geography: describing how social structure varies across a metropolitan area, as in the source article's Greater Dublin study
  • Regional economics: examining whether labour-market indicators cluster differently in metropolitan and peripheral areas
  • Ecology: examining whether axes of species-trait covariation along environmental gradients differ between locations

How it works

How it works

1

For a focal location i with coordinates (u_i, v_i), each observation j receives a weight w_ij that depends on its distance d_ij from i and on a bandwidth h. The bisquare kernel in the formula gives zero weight beyond h and smoothly declining weights within it. A Gaussian kernel is the other common choice; it lets weights decay without a hard cutoff. The bandwidth is the main tuning parameter and is commonly chosen by minimising a cross-validation score or an information criterion such as AIC.

Formula
w_{ij} = \left(1 - \left(\frac{d_{ij}}{h}\right)^2\right)^2 \cdot \mathbf{1}\left[d_{ij} < h\right]
2

Using these kernel weights, a weighted covariance matrix S(u_i, v_i) is computed at location i, with each observation contributing in proportion to its weight. Here x̄_i is the kernel-weighted mean at i, x̄_i = Σ_j w_ij x_j / Σ_j w_ij, so each observation's deviation is measured from the local rather than the global mean. The result is a p × p matrix describing how the p variables co-vary in the neighbourhood of i.

Formula
\mathbf{S}(u_i, v_i) = \frac{\sum_j w_{ij}(\mathbf{x}_j - \bar{\mathbf{x}}_i)(\mathbf{x}_j - \bar{\mathbf{x}}_i)^\top}{\sum_j w_{ij}}
3

The weighted covariance matrix at i is decomposed via eigenanalysis: S(u_i, v_i) e_ik = lambda_ik e_ik, yielding local eigenvalues lambda_ik and eigenvectors e_ik for k = 1, …, p. These local eigenvectors play the role of principal component axes for the neighborhood around i, and local eigenvalues indicate how much variance each component captures there.

Formula
\mathbf{S}(u_i, v_i)\, \mathbf{e}_{ik} = \lambda_{ik}\, \mathbf{e}_{ik}
4

Local principal component scores for nearby observations are obtained by projecting mean-centered data onto the local eigenvectors. Because the entire analysis is repeated at every calibration location, outputs include maps of local eigenvalues, maps of local loadings for each variable on each component, and, optionally, maps of local component scores — all of which can be visualized to detect spatial patterns in dimensionality structure.

Formula
z_{ijk} = (\mathbf{x}_j - \bar{\mathbf{x}}_i)^\top \mathbf{e}_{ik}

Common pitfalls

  • Comparing local loadings across locations without resolving sign flips can produce spurious spatial patterns
  • A very small bandwidth yields unstable local estimates driven by few observations
  • GWPCA output is descriptive and exploratory; treating local loadings as confirmatory evidence of spatial difference is inappropriate
  • Edge effects near the boundary of the study area, where fewer neighbours fall within the kernel, can make local estimates less reliable
  • Harris et al. (2011) treat testing of location-specific results as a core implementation issue. Before reading a mapped difference in local eigenvalues or loadings as genuine spatial variation, check its stability across neighbouring bandwidths and the number of effective observations contributing at each location.

Frequently asked questions

How do I choose the bandwidth for GWPCA?

The usual approach is to select the bandwidth that minimises a cross-validation score or an information criterion such as AIC, evaluated over a set of candidate values. Fixed-distance and adaptive (neighbour-based) bandwidths are both used in geographically weighted methods; adaptive bandwidths can help when observations are unevenly spread. Check which options your software implements.

How do I compare local principal components across locations when eigenvector signs can flip?

Local eigenvectors are defined only up to a sign change, so a raw map of loadings can show spurious reversals. One option is to apply a fixed sign convention before mapping or comparing, for example making the largest-magnitude loading of each local eigenvector positive. Check how your software handles signs rather than assuming it does.

Can GWPCA be used with non-Euclidean or network distances?

In principle yes. The kernel needs only a distance between locations, so road-network or great-circle distances can replace Euclidean distance. Bandwidth-selection routines may, however, assume Euclidean distance, in which case custom code may be needed. Storing a full distance matrix also grows with the square of the number of locations, which can become a memory constraint for large datasets.

Related methods

Sources

  1. Harris, P., Brunsdon, C., & Charlton, M. (2011). Geographically weighted principal components analysis. International Journal of Geographical Information Science, 25(10), 1717–1736.

    Open DOI reference