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%
A tool for estimating systems of related economic equations with potentially correlated errors using Seemingly Unrelated Regression (SUR).
You need to build a system that can estimate multiple related regression equations simultaneously. The system should handle cases where the error terms across equations may be correlated, which makes joint estimation more efficient than separate equation-by-equation estimation.
Your implementation should support:
@generates
def estimate_sur_system(equation_data: dict) -> dict:
"""
Estimates a system of seemingly unrelated regression equations.
Parameters
----------
equation_data : dict
Dictionary where keys are equation names and values are dicts containing:
- 'y': numpy array of dependent variable (n x 1)
- 'x': numpy array of independent variables (n x k)
Returns
-------
dict
Dictionary containing:
- 'coefficients': dict mapping equation names to coefficient arrays
- 'std_errors': dict mapping equation names to standard error arrays
- 'r_squared': dict mapping equation names to R-squared values
- 'log_likelihood': float, log-likelihood of the system
Examples
--------
>>> import numpy as np
>>> data = {
... 'eq1': {'y': np.array([[1], [2], [3]]),
... 'x': np.array([[1, 2], [1, 3], [1, 4]])},
... 'eq2': {'y': np.array([[2], [4], [6]]),
... 'x': np.array([[1, 1], [1, 2], [1, 3]])}
... }
>>> results = estimate_sur_system(data)
>>> results['coefficients']['eq1']
array([...])
"""
passProvides spatial econometric regression models including SUR estimation.
@satisfied-by