Spatial econometric regression models for analyzing geographically-related data interactions.
Overall
score
87%
Build a spatial econometric analysis tool that estimates the effect of property characteristics on housing prices while accounting for endogeneity and testing for spatial autocorrelation in an instrumental variables framework.
In housing price analysis, certain variables like renovation expenditure may be endogenous (correlated with unobserved factors in the error term). When analyzing spatial data with endogenous variables, it's important to use instrumental variables estimation and test for spatial autocorrelation that might bias the results.
Your program should accept the following inputs:
prices: Housing prices (dependent variable)characteristics: Exogenous property characteristics such as square footage, number of bedrooms, age, etc.renovation_spending: Endogenous variable representing renovation expenditureneighborhood_income: External instrument for renovation spendingspatial_weights: A spatial weights matrix representing neighborhood relationshipsEstimate a housing price model that:
Perform diagnostic tests to assess:
Your program should output:
Given:
Expected:
Given:
Expected:
@generates
def analyze_housing_prices(prices, characteristics, renovation_spending,
neighborhood_income, spatial_weights):
"""
Estimate a spatial IV model for housing prices and perform diagnostic tests.
Parameters:
-----------
prices : array-like
Dependent variable (housing prices)
characteristics : array-like
Exogenous independent variables (property characteristics)
renovation_spending : array-like
Endogenous variable (renovation expenditure)
neighborhood_income : array-like
Instrument for the endogenous variable
spatial_weights : spatial weights object
Spatial weights matrix representing neighborhood relationships
Returns:
--------
dict with keys:
'coefficients': Estimated coefficients for all variables
'endogeneity_test_statistic': Test statistic for endogeneity
'endogeneity_test_pvalue': P-value for endogeneity test
'spatial_test_statistic': Test statistic for spatial autocorrelation in IV model
'spatial_test_pvalue': P-value for spatial autocorrelation test
'has_spatial_autocorrelation': Boolean indicating if spatial autocorrelation detected
"""
passProvides spatial regression and diagnostic testing capabilities for econometric analysis.
Provides numerical array operations.
Install with Tessl CLI
npx tessl i tessl/pypi-spregdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10