or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/spreg@1.8.x
tile.json

tessl/pypi-spreg

tessl install tessl/pypi-spreg@1.8.0

Spatial 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%

task.mdevals/scenario-2/

Regional Economic Spillover Analysis

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.

Problem Context

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.

Requirements

Data Structure

Your implementation should handle the following data inputs:

  1. Region identifiers: A numeric array identifying each region (e.g., [1, 2, 3, ...])
  2. Housing price index: Dependent variable for equation 1
  3. Employment rate: Dependent variable for equation 2
  4. Income levels: Exogenous variable affecting both equations
  5. Population density: Exogenous variable affecting housing prices
  6. Education index: Exogenous variable affecting employment
  7. Interest rate: External instrument for housing prices
  8. Business tax rate: External instrument for employment
  9. Spatial weights: A matrix representing spatial relationships between regions

Core Functionality

Implement a function estimate_regional_spillovers() that:

  1. Accepts two equations as a system where:

    • Equation 1 models housing price index
    • Equation 2 models employment rate
    • Both equations may include endogenous variables from the other equation
  2. Uses instrumental variables estimation to handle endogeneity

  3. Accounts for cross-equation error correlation

  4. Returns model results including:

    • Coefficient estimates for all variables in both equations
    • Standard errors
    • Model diagnostics

Test Cases

  • 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

Implementation

@generates

API

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
    """
    pass

Dependencies { .dependencies }

spreg { .dependency }

Provides spatial econometric regression models including three-stage least squares estimation for systems of equations with spatial dependencies.

@satisfied-by