Skip to contents

Implements the standard LeSage & Pace formula:

Usage

mrm_spatial_spillover_decomposition(
  rho,
  beta_direct,
  beta_spatial,
  W,
  coefficient_names = NULL
)

Arguments

rho

Numeric scalar. Spatial-autoregressive coefficient from the fitted SDM.

beta_direct

Numeric vector of length \(K\). Coefficients on the K covariates (no lagged terms).

beta_spatial

Numeric vector of length \(K\). Coefficients on the spatially-lagged covariates (\(WX\)). Set to all zeros if you fit a SAR (lag-only) model.

W

Numeric matrix of shape (N, N). Row-standardised spatial weight matrix.

coefficient_names

Optional character vector of length K with human-readable covariate names; defaults to c("x1", ..., "xK").

Value

A named list with classes morie_mrm_result, morie_rich_result, list. Carries decomposition (a data.frame with columns coefficient, direct, indirect, total, note), rho, plus interpretation + warnings.

Details

$$(I - \rho W)^{-1} (I \beta_k + W \theta_k)$$

for each covariate \(k\). The diagonal of the resulting per-observation effects matrix is averaged for the direct effect; the average off-diagonal-row-sum is the indirect effect; total = direct + indirect.

Examples

set.seed(3)
N <- 12
W <- matrix(runif(N * N), N, N)
diag(W) <- 0
W <- W / rowSums(W)
res <- mrm_spatial_spillover_decomposition(
  rho = 0.4,
  beta_direct  = c(0.10, -0.05),
  beta_spatial = c(0.30,  0.00),
  W = W,
  coefficient_names = c("gentrification", "controls")
)
res$decomposition
#>      coefficient      direct    indirect       total
#> 1 gentrification  0.11957164  0.54709503  0.66666667
#> 2       controls -0.05115127 -0.03218206 -0.08333333
#>                                                                        note
#> 1 Per-observation marginal effects averaged across N=12 units (rho=0.4000).
#> 2 Per-observation marginal effects averaged across N=12 units (rho=0.4000).