- Introduced by
- Wheeler & Calder (2007); Finley (2011)
- Year
- 2007
- Type
- Bayesian spatially varying coefficient regression
- Family
- GIS / spatial
What does it do?
Bayesian Geographically Weighted Regression (BGWR) is a name used for several Bayesian approaches to spatially varying regression coefficients.
This page describes one common version, a Bayesian spatially varying coefficient (SVC) model with Gaussian process priors on the local coefficients. It yields a posterior distribution for each coefficient at every location, so uncertainty is quantified rather than only point estimates reported. Other implementations, such as the bgwr function in the spatial econometrics toolbox, may use different priors or weighting schemes.
The intuition behind the method
Imagine fitting a separate regression at every location on a map, letting each slope and intercept drift smoothly across space. Classical GWR does this by weighting nearby observations in each local fit. The Bayesian SVC version treats the spatially varying coefficients as unknowns drawn from a Gaussian process, then uses Bayes' rule to combine this prior expectation of spatial smoothness with the data. The result is a posterior distribution for each coefficient at each location. A 95% credible interval has a direct probabilistic reading: given the model, the kernel and the priors, the coefficient lies in that interval with 95% posterior probability. This statement is conditional on those choices and can change under a different specification. For example, the effect of income on house price might be estimated at 0.3 here, with a 95% credible interval from 0.1 to 0.5. The interval tends to widen where data are sparse or noisy.
History
Geographically weighted regression was developed to model spatial nonstationarity in regression coefficients, and Bayesian spatially varying coefficient models were later developed as an alternative. The consulted sources do not identify a single originator of the Bayesian formulation, and the name 'Bayesian GWR' is used for more than one formulation. Wheeler and Calder (2007) assessed the accuracy of coefficient estimates in linear regression models with spatially varying coefficients. Finley (2011) compared GWR with Bayesian spatially varying coefficient models on synthetic and ecological data, showing that the two can produce very different coefficient surfaces and highlighting the trade-off between the richer inference of the Bayesian approach and its computational demands.
When to use it
Use BGWR when the relationship between a predictor and the outcome is expected to vary across space, and you need credible intervals for each local coefficient. Typical cases are disease risk factors that differ between regions, species-environment relationships across a landscape, or house price determinants that differ across a city. It is well suited to settings where local data density varies, so that uncertainty should widen where observations are sparse. Do not use it when the relationship is plausibly stationary across space; a global regression, with or without spatial dependence terms, is then simpler and may be sufficient. Avoid it for very large datasets, because exact GP inference becomes computationally prohibitive without approximations. Also avoid it when the analyst cannot specify priors and assess MCMC convergence, since poorly chosen priors or unchecked sampling can give misleading posteriors. Be cautious when predictors are strongly correlated locally, since coefficients may then be poorly identified.
Limitations and considerations
- Computationally demanding: exact GP inference scales as O(n^3) in time, and storing the n-by-n covariance matrix is also costly. Large datasets therefore need approximations (e.g., sparse GP, NNGP).
- Requires specification of the GP covariance kernel family and prior distributions on hyperparameters; results can be sensitive to these choices.
- MCMC-based fitting requires convergence diagnostics and can be slow on moderately sized spatial datasets.
- Interpretation of spatially varying posteriors is more complex than classical regression output, requiring spatial visualisation and GIS expertise.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Produces full posterior distributions for spatially varying coefficients, enabling credible intervals at every location.
- Naturally propagates uncertainty from sparse data regions into wider credible intervals rather than artificially narrow point estimates.
- Covariance parameters such as range, sill and nugget are estimated from the data together with the coefficients, rather than being fixed in advance by the analyst.
- The GP prior shrinks local estimates toward neighbouring values, which reduces variance in small local samples, at the cost of dependence on the prior and kernel.
- Can be extended to non-Gaussian likelihoods (logistic, Poisson) for binary or count spatial outcomes.
Applications
- Epidemiology: estimating how socioeconomic predictors of disease incidence vary across counties or health districts.
- Real-estate economics: mapping spatially varying hedonic price coefficients (e.g., the effect of school quality on house prices differs by neighbourhood).
- Ecology: modelling how climate variables drive species abundance differently across a landscape.
- Agricultural science: understanding how soil properties predict crop yield at fine spatial scales with uncertainty bounds.
- Urban planning: assessing whether the relationship between transit access and employment varies across a metropolitan area.
- Environmental science: quantifying spatially heterogeneous effects of pollution sources on health outcomes.
How it works
How it works
The response y at location s_i is modelled as the dot product of local predictors x_i and spatially varying coefficients beta(s_i), plus a noise term. This is identical in form to standard GWR, but the coefficients are treated as latent random functions rather than deterministic estimates.
Formula
y_i = \mathbf{x}_i^\top \boldsymbol{\beta}(\mathbf{s}_i) + \varepsilon_iA Gaussian process (GP) prior is placed over the vector of regression coefficients as a function of geographic location. The GP covariance kernel K(s, s') encodes the assumption that nearby locations have similar coefficients; typical choices include exponential, Matern, or squared-exponential kernels parameterised by a range parameter phi. A full specification needs priors for the GP mean, for the kernel variance and range (and smoothness if a Matern kernel is used), and for the noise variance sigma^2. Because results can depend on these priors, check their influence with a sensitivity analysis.
Formula
\boldsymbol{\beta}(\mathbf{s}) \sim \mathcal{GP}(\boldsymbol{\mu},\, K(\mathbf{s},\mathbf{s}'))The noise terms are assumed to be independent Gaussian with mean zero and variance sigma^2. The likelihood is therefore the standard normal linear regression likelihood evaluated at the spatially varying coefficients.
Formula
\varepsilon_i \sim \mathcal{N}(0,\sigma^2)Applying Bayes' theorem combines the GP prior with the data likelihood to give the joint posterior distribution of all spatially varying coefficients. With a Gaussian likelihood and fixed covariance parameters, this posterior is Gaussian and available in closed form. When covariance parameters are themselves estimated, or the likelihood is non-Gaussian (for example logistic or Poisson), the posterior is generally not available in closed form, and MCMC (such as Hamiltonian Monte Carlo) or variational inference is used.
Formula
p(\boldsymbol{\beta}(\mathbf{s}) \mid \mathbf{y}) \propto p(\mathbf{y} \mid \boldsymbol{\beta}(\mathbf{s}))\, p(\boldsymbol{\beta}(\mathbf{s}))Posterior summaries (posterior means, credible intervals and exceedance probabilities) are computed for each coefficient at each location and at prediction locations. Model comparison with WAIC or DIC can assess whether spatial variation in the coefficients is supported by the data. MCMC convergence diagnostics, such as Rhat close to 1 and adequate effective sample sizes, should be checked before these summaries are reported.
Formula
\boldsymbol{\beta} \mid \mathbf{y}, \sigma^2, \theta \sim \mathcal{N}(\mathbf{m}, \mathbf{V}),\quad \mathbf{V} = (\mathbf{X}^\top \mathbf{X}/\sigma^2 + \mathbf{K}^{-1})^{-1},\quad \mathbf{m} = \mathbf{V}(\mathbf{X}^\top \mathbf{y}/\sigma^2 + \mathbf{K}^{-1}\boldsymbol{\mu})Common pitfalls
- Using a misspecified kernel (e.g., isotropic when anisotropy is present) can produce poorly calibrated spatial predictions; always visualise the empirical variogram before choosing a kernel.
- Reporting only the posterior mean of local coefficients without credible intervals defeats the purpose of the Bayesian framework; always map uncertainty alongside point estimates.
- Ignoring MCMC diagnostics (Rhat, effective sample size): non-convergence produces unreliable posteriors that look plausible but are wrong.
- Treating BGWR coefficients as independent across space after fitting; the spatial correlation structure is central to the model and should inform how results are aggregated or compared.
- Applying BGWR to outcomes where spatial nonstationarity is not substantively plausible inflates model complexity without improving inference.
- Local collinearity among predictors can make coefficient surfaces unstable and weakly identified; inspect predictor correlations and posterior correlations between coefficients.
- Extrapolating coefficient surfaces beyond the sampled area is unreliable, because predictions there revert largely to the prior.
Frequently asked questions
How does BGWR differ from classical GWR?
Classical GWR estimates spatially varying coefficients by kernel-weighted local least squares, with the bandwidth typically chosen by cross-validation, and gives an estimate for each location. BGWR places GP priors on the coefficients and produces full posterior distributions, which support credible intervals and probabilistic statements about spatial variation. In the hierarchical formulation, covariance parameters such as the range are estimated from the data rather than fixed by a bandwidth choice. Finley (2011) found that the two approaches can yield very different coefficient surfaces.
What is the biggest practical challenge of BGWR?
Computational cost. Exact GP inference scales as O(n^3) in time, so large datasets need approximations such as the nearest-neighbour Gaussian process (NNGP), implemented in the R package spNNGP, or sparse GP methods. The sample size at which this becomes necessary depends on the model and available hardware, so check feasibility on your own data.
How do I choose the GP covariance kernel?
Inspect the empirical semivariogram of the residuals from a non-spatial model to judge the plausible range and nugget. The Matern kernel is commonly used, with smoothness nu = 1.5 or 2.5 as frequently chosen values. Run a sensitivity analysis by comparing DIC or WAIC across kernel choices.
Can BGWR handle binary or count outcomes?
Yes. By replacing the Gaussian likelihood with a logistic or Poisson likelihood and retaining the GP prior on spatially varying coefficients, you obtain Bayesian spatially varying coefficient logistic or Poisson regression. Fitting requires MCMC or Laplace approximation because the posterior is no longer Gaussian.
Which software implements BGWR?
The R package spBayes implements Bayesian spatially varying coefficient models. A bgwr function also appears in the spatial econometrics toolbox for MATLAB, alongside gwr, and may use a different formulation from the GP-prior model described here. Stan and brms are general tools that can fit custom GP-based models, and for large n, spNNGP provides scalable Bayesian spatial regression using nearest-neighbour Gaussian processes.
Related methods
Sources
Finley, A. O. (2011). Comparing spatially-varying coefficients models for analysis of ecological data with non-stationary and anisotropic residual dependence. Methods in Ecology and Evolution, 2(2), 143-154.
Open DOI referenceWheeler, D., & Calder, C. (2007). An assessment of coefficient accuracy in linear regression models with spatially varying coefficients. Journal of Geographical Systems, 9(2), 145-166.
Open DOI referenceIntroduction to Spatial Econometrics, p. ?