Research note

Bayesian Spatially Varying Coefficient Model — Gen 1

Gen 1 extends the initial design by allowing all coefficients to vary over space via latent Gaussian processes defined on standardized latitude/longitude. Correlation follows the exponential form \(r(d;\,\phi)=\exp(-d/\phi)\) with a shared length scale \(\phi\), and per-coefficient magnitudes \(\rho_k\) control variability. Inference uses PyMC with NUTS (NumPyro/JAX when available) on the target \( \log(\text{price}) \).

This model captures heterogeneous neighborhood effects beyond size alone, providing a more flexible foundation for local price dynamics across Prague.

Model

The log-price \(y_i\) for listing \(i\) at location \(\mathbf{s}_i\) is modeled as a spatially varying linear combination of features:

$$y_i \;=\; \sum_{k=0}^{K-1} \beta_k(\mathbf{s}_i)\, x_{ik} \;+\; \varepsilon_i,\qquad \varepsilon_i \sim \mathcal{N}(0,\sigma^2),$$ $$\beta_k(\mathbf{s}) \sim \mathcal{GP}\!\big(0,\; \rho_k^2\, k_\phi(\mathbf{s},\mathbf{s}')\big), \quad k_\phi(\mathbf{s},\mathbf{s}') \;=\; \exp\!\Big(-\tfrac{\|\mathbf{s}-\mathbf{s}'\|}{\phi}\Big).$$

Each coefficient—including the intercept—has its own latent GP sharing the same exponential length scale \(\phi\), while \(\rho_k\) scales per-coefficient variability. Coordinates are standardized for numerical stability.

Features

  • Target: \(\log(\text{price})\)
  • Spatial inputs: standardized \((\text{lat}_{std}, \text{lon}_{std})\)
  • Design (all vary spatially): intercept, area\(_{std}\), disposition, ownership, loggia size, parking lots, floor\(_{std}\), elevator present, distance to public transport\(_{std}\), distance to metro, time trend
Compared to Gen 0 (where only the size coefficient varied), Gen 1 lets the data learn location-dependent effects for every covariate, e.g., floor premium or metro proximity varying by neighborhood.

Benchmark

Observed vs Predicted, log-price — Gen 1
Gen 1 observed vs predicted (test) on log-price (45° dashed). Metrics computed in log space.
Example spatial coefficient maps — Gen 1
Example posterior mean fields of spatial coefficients (e.g., intercept and size effect). Darker tones indicate larger magnitude.

Training & Inference

CLI Usage

Example run (single chain, NumPyro if available):

python gen_1_model.py --fit --draws 800 --chains 1 --save-dir artifacts/svcp_all

Notes & Next Steps

Gen 0 Gen 1