tessl install tessl/pypi-spreg@1.8.0Spatial econometric regression models for analyzing geographically-related data interactions.
Agent Success
Agent success rate when using this tile
87%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.95x
Baseline
Agent success rate without this tile
92%
Implement a system to analyze economic spillovers between regional housing markets and employment levels. The system should estimate a two-equation model where housing prices and employment rates influence each other across neighboring regions.
Regional economies interact through spatial spillovers. Housing prices in one region may affect employment in neighboring regions through labor mobility. Similarly, employment opportunities influence housing demand. These relationships form a simultaneous system where both variables are endogenous and spatially correlated.
Your implementation should handle the following data inputs:
Implement a function estimate_regional_spillovers() that:
Accepts two equations as a system where:
Uses instrumental variables estimation to handle endogeneity
Accounts for cross-equation error correlation
Returns model results including:
Given synthetic data with 50 regions, income levels, population density, education index, and appropriate instruments, the function returns coefficient estimates for both equations. @test
Given a spatial weights matrix with 50 regions and the full system specification, the function produces standard errors for all coefficients in both equations. @test
Given a system where equation 1 uses employment as an endogenous variable and equation 2 uses housing prices as an endogenous variable, the function completes estimation and returns results for both equations. @test
@generates
def estimate_regional_spillovers(housing_price_data, employment_data, exog_vars,
instruments, spatial_weights):
"""
Estimate a two-equation spatial system with cross-equation endogeneity.
Parameters
----------
housing_price_data : dict
Dictionary containing 'y' (housing price index) and 'x' (exogenous variables
for equation 1) as numpy arrays
employment_data : dict
Dictionary containing 'y' (employment rate) and 'x' (exogenous variables
for equation 2) as numpy arrays
exog_vars : dict
Dictionary with keys 'eq1' and 'eq2' mapping to lists of exogenous variable
indices
instruments : dict
Dictionary with keys 'eq1' and 'eq2' mapping to instrument arrays
spatial_weights : object
Spatial weights matrix representing regional connectivity
Returns
-------
results : object
Model results containing coefficient estimates, standard errors, and
diagnostics for the system
"""
passProvides spatial econometric regression models including three-stage least squares estimation for systems of equations with spatial dependencies.
@satisfied-by