Skip to content

New feature: Different spatial weight matrices for lag and error terms #186

@robcoelli-98

Description

@robcoelli-98

Hello,

This is my first time raising an issue here, so please let me know if this isn’t the right way to propose this.

Feature request

When a model includes more than one spatial term, it would be useful to allow different spatial weight matrices for each term. This affects all GM_Combo* and ML_Combo* classes.

Motivation

An example of this is the SARAR (SAC) model where there may be a different spatial relationship for the dependent variable and the error term:

$$ \begin{align} \mathbf{y} &= \rho \mathbf{W_1} \mathbf{y} + \mathbf{X}\boldsymbol{\beta} + \mathbf{u} \\ \mathbf{u} &= \lambda \mathbf{W_2} \mathbf{u} + \boldsymbol{\varepsilon} \\ \end{align} $$

In the current implementation $\mathbf{W_1}=\mathbf{W_2}$ and there is no possibility for $\mathbf{W_1} \neq \mathbf{W_2}$.

As a concrete example of why this is an issue, I'm estimating a SARAR model to explore the drivers of agricultural land values. In the structural form above, $\mathbf{W_1} \mathbf{y}$ is included because farmers benchmark their sales price based on the prices of farms sold around them in the previous n years. This means that $\mathbf{W_1}$ must be time filtered. However, $\mathbf{W_2} \mathbf{u}$ is included to partially control for spatially correlated omitted variables, and these spatial features are likely to be largely time invariant so the spatial weight matrix doesn't need to be time filtered.

This feature is implemented in R through the spatialreg package, which I used for the current project. But I would have much preferred to keep the entire workflow in Python.

Potential API change
Backwards compatibility could be maintained by additional keyword arguments allowing you to specify an additional spatial weight matrix if you choose, with the first by default being the spatial weight matrix for the spatially lagged dependent variable.

GM_Combo(y, x, w, w_error=None)

Happy to hear thoughts on whether this would be useful for others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions