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-9/

Regional Economic Analysis System

Build a system to analyze the simultaneous effects of employment and income across regions using spatial econometric models.

Context

You are tasked with analyzing two interrelated economic outcomes across multiple regions: employment growth and income growth. These outcomes are correlated with each other (cross-equation correlation) and each may exhibit different patterns of spatial spillovers. Your analysis should account for the fact that spatial effects may differ between the two equations.

Requirements

Build a spatial econometric analysis system that:

  1. Accepts three datasets as input:

    • Employment growth data (dependent variable for equation 1) and its predictors (population density, industry diversity)
    • Income growth data (dependent variable for equation 2) and its predictors (education level, service sector share)
    • A spatial weights matrix that captures regional connectivity
  2. Estimates a simultaneous equations model that:

    • Treats the two equations as a system to capture cross-equation error correlation
    • Allows each equation to have its own spatial error parameter
    • Returns coefficient estimates, spatial parameters, and standard errors for both equations

Data Specifications

Input data structure:

  • All dependent and independent variables are provided as numpy arrays
  • The spatial weights matrix is provided as a PySAL W object
  • Sample size: approximately 50-100 regions
  • All variables are continuous and properly scaled

Testing

  • The system correctly estimates a two-equation spatial SUR model with equation-specific spatial error parameters @test
  • The system returns coefficient estimates and spatial parameters for both equations @test
  • The spatial error parameters differ between equations when data exhibits different spatial patterns @test

Implementation

@generates

API

def estimate_regional_model(
    employment_y, employment_X,
    income_y, income_X,
    spatial_weights
):
    """
    Estimate a spatial SUR model for regional economic analysis.

    Parameters
    ----------
    employment_y : array-like
        Dependent variable for employment equation
    employment_X : array-like
        Independent variables for employment equation
    income_y : array-like
        Dependent variable for income equation
    income_X : array-like
        Independent variables for income equation
    spatial_weights : W object
        Spatial weights matrix

    Returns
    -------
    dict
        Dictionary containing:
        - 'coefficients_eq1': Coefficient estimates for equation 1
        - 'coefficients_eq2': Coefficient estimates for equation 2
        - 'spatial_param_eq1': Spatial error parameter for equation 1
        - 'spatial_param_eq2': Spatial error parameter for equation 2
        - 'std_errors_eq1': Standard errors for equation 1
        - 'std_errors_eq2': Standard errors for equation 2
    """
    pass

Dependencies { .dependencies }

spreg { .dependency }

Provides spatial econometric regression models with support for SUR systems.

numpy { .dependency }

Provides array operations for numerical computing.

libpysal { .dependency }

Provides spatial weights matrix functionality.