=== versions === python 3.12.0 | spreg 1.9.1 | libpysal 4.15.1 | esda 2.10.0 | geopandas 1.2.0 | numpy 2.5.4 === data === 301 MSOAs with a median price and census data: Leeds 107, Bradford 63, Kirklees 59, Wakefield 45, Calderdale 27 price level4 detached no_car density mean 215382.2 30.1 17.5 26.1 2987.3 min 72500.0 15.1 0.2 7.2 94.1 50% 202500.0 28.5 14.7 23.2 2512.7 max 605000.0 62.8 64.3 66.9 19894.8 cheapest: Pellon East (Calderdale) GBP 72,500 | dearest: Collingham, Rigton & Harewood (Leeds) GBP 605,000 correlations with ln(price): level4 +0.72, detached +0.68, no_car -0.72, ln_density -0.51 === spatial weights === queen contiguity: mean 5.72 neighbours (min 1, max 12), islands 0 === OLS with spatial diagnostics (queen weights) === REGRESSION RESULTS ------------------ SUMMARY OF OUTPUT: ORDINARY LEAST SQUARES ------------------------------------------------------------------------------------ Data set :West Yorkshire MSOAs Weights matrix : queen Dependent Variable : ln_price Number of Observations: 301 Mean dependent var : 12.2243 Number of Variables : 5 S.D. dependent var : 0.3335 Degrees of Freedom : 296 R-squared : 0.7391 Adjusted R-squared : 0.7356 Sum squared residual: 8.70381 F-statistic : 209.6490 Sigma-square : 0.029 Prob(F-statistic) : 4.76e-85 S.E. of regression : 0.171 Log likelihood : 106.174 Sigma-square ML : 0.029 Akaike info criterion : -202.347 S.E of regression ML: 0.1700 Schwarz criterion : -183.812 ------------------------------------------------------------------------------------ Variable Coefficient Std.Error t-Statistic Probability ------------------------------------------------------------------------------------ CONSTANT 11.92240 0.12372 96.36918 0.00000 level4 0.01679 0.00115 14.62319 0.00000 detached 0.00410 0.00143 2.87367 0.00435 no_car -0.01132 0.00137 -8.27682 0.00000 ln_density 0.00270 0.01388 0.19473 0.84574 ------------------------------------------------------------------------------------ REGRESSION DIAGNOSTICS MULTICOLLINEARITY CONDITION NUMBER 33.723 TEST ON NORMALITY OF ERRORS TEST DF VALUE PROB Jarque-Bera 2 5.569 0.0618 DIAGNOSTICS FOR HETEROSKEDASTICITY RANDOM COEFFICIENTS TEST DF VALUE PROB Breusch-Pagan test 4 47.790 0.0000 Koenker-Bassett test 4 36.294 0.0000 DIAGNOSTICS FOR SPATIAL DEPENDENCE - SARERR - TEST MI/DF VALUE PROB Moran's I (error) 0.4570 13.587 0.0000 Lagrange Multiplier (lag) 1 154.879 0.0000 Robust LM (lag) 1 32.072 0.0000 Lagrange Multiplier (error) 1 168.795 0.0000 Robust LM (error) 1 45.988 0.0000 Lagrange Multiplier (SARMA) 2 200.867 0.0000 - Spatial Durbin - TEST DF VALUE PROB LM test for WX 4 51.261 0.0000 Robust LM WX test 4 65.177 0.0000 Lagrange Multiplier (lag) 1 154.879 0.0000 Robust LM Lag - SDM 1 168.795 0.0000 Joint test for SDM 5 220.056 0.0000 ================================ END OF REPORT ===================================== VIF: level4 1.26, detached 3.06, no_car 2.76, ln_density 1.91 === Moran's I of the OLS residuals === I = 0.457 E[I] = -0.0033 z(permutation) = 13.2 pseudo p = 0.0001 largest of 9999 permuted I values: 0.137 Pellon East (Calderdale): residual -0.616 = price -46% vs the OLS fit Central Bradford (Bradford): residual -0.541 = price -42% vs the OLS fit Birkby (Kirklees): residual -0.471 = price -38% vs the OLS fit Dewsbury Central & Westborough (Kirklees): residual -0.456 = price -37% vs the OLS fit === spatial lag model (ML) === ML_Lag fitted in 1.38 s REGRESSION RESULTS ------------------ SUMMARY OF OUTPUT: MAXIMUM LIKELIHOOD SPATIAL LAG (METHOD = FULL) ------------------------------------------------------------------------------------ Data set : unknown Weights matrix : queen Dependent Variable : ln_price Number of Observations: 301 Mean dependent var : 12.2243 Number of Variables : 6 S.D. dependent var : 0.3335 Degrees of Freedom : 295 Pseudo R-squared : 0.8478 Spatial Pseudo R-squared: 0.7592 Log likelihood : 178.2843 Sigma-square ML : 0.0169 Akaike info criterion : -344.569 S.E of regression : 0.1299 Schwarz criterion : -322.326 ------------------------------------------------------------------------------------ Variable Coefficient Std.Error z-Statistic Probability ------------------------------------------------------------------------------------ CONSTANT 5.47883 0.49081 11.16291 0.00000 level4 0.01004 0.00096 10.40825 0.00000 detached 0.00430 0.00108 3.98087 0.00007 no_car -0.00746 0.00110 -6.80945 0.00000 ln_density 0.01291 0.01060 1.21806 0.22320 W_ln_price 0.52841 0.03884 13.60451 0.00000 ------------------------------------------------------------------------------------ SPATIAL LAG MODEL IMPACTS Impacts computed using the 'full' method. Variable Direct Indirect Total level4 0.0107 0.0106 0.0213 detached 0.0046 0.0045 0.0091 no_car -0.0080 -0.0079 -0.0158 ln_density 0.0138 0.0136 0.0274 ================================ END OF REPORT ===================================== === spatial lag impacts with 95% simulation intervals (2,000 draws) === rho = 0.528; spatial multiplier 1/(1-rho) = 2.12 level4 direct +0.0107 [+0.0089, +0.0127] indirect +0.0106 [+0.0081, +0.0139] total +0.0213 [+0.0178, +0.0256] detached direct +0.0046 [+0.0022, +0.0069] indirect +0.0045 [+0.0020, +0.0075] total +0.0091 [+0.0044, +0.0142] no_car direct -0.0080 [-0.0102, -0.0056] indirect -0.0079 [-0.0108, -0.0054] total -0.0158 [-0.0202, -0.0114] ln_density direct +0.0138 [-0.0083, +0.0371] indirect +0.0136 [-0.0077, +0.0399] total +0.0274 [-0.0159, +0.0759] level4: +10 percentage points everywhere -> total +23.7% on prices (direct +11.3%); OLS said +18.3% === spatial error model (ML) === ML_Error REGRESSION RESULTS ------------------ SUMMARY OF OUTPUT: ML SPATIAL ERROR (METHOD = full) ------------------------------------------------------------------------------------ Data set : unknown Weights matrix : queen Dependent Variable : ln_price Number of Observations: 301 Mean dependent var : 12.2243 Number of Variables : 5 S.D. dependent var : 0.3335 Degrees of Freedom : 296 Pseudo R-squared : 0.6956 Log likelihood : 187.4028 Sigma-square ML : 0.0143 Akaike info criterion : -364.806 S.E of regression : 0.1197 Schwarz criterion : -346.270 ------------------------------------------------------------------------------------ Variable Coefficient Std.Error z-Statistic Probability ------------------------------------------------------------------------------------ CONSTANT 12.34069 0.12273 100.55231 0.00000 level4 0.00783 0.00131 6.00037 0.00000 detached 0.00491 0.00111 4.43077 0.00001 no_car -0.01056 0.00131 -8.06595 0.00000 ln_density -0.01998 0.01226 -1.62946 0.10322 lambda 0.79614 0.04087 19.47824 0.00000 ------------------------------------------------------------------------------------ ================================ END OF REPORT ===================================== === spatial Durbin model (ML lag with WX), for comparison === ML_Lag REGRESSION RESULTS ------------------ SUMMARY OF OUTPUT: MAXIMUM LIKELIHOOD SPATIAL LAG WITH SLX - SPATIAL DURBIN MODEL (METHOD = FULL) ------------------------------------------------------------------------------------ Data set : unknown Weights matrix : queen Dependent Variable : ln_price Number of Observations: 301 Mean dependent var : 12.2243 Number of Variables : 10 S.D. dependent var : 0.3335 Degrees of Freedom : 291 Pseudo R-squared : 0.8767 Spatial Pseudo R-squared: 0.7787 Log likelihood : 201.0275 Sigma-square ML : 0.0137 Akaike info criterion : -382.055 S.E of regression : 0.1171 Schwarz criterion : -344.984 ------------------------------------------------------------------------------------ Variable Coefficient Std.Error z-Statistic Probability ------------------------------------------------------------------------------------ CONSTANT 3.57270 0.61007 5.85617 0.00000 level4 0.00659 0.00133 4.96495 0.00000 detached 0.00560 0.00110 5.07706 0.00000 no_car -0.00989 0.00134 -7.39980 0.00000 ln_density -0.01754 0.01217 -1.44141 0.14947 W_level4 0.00098 0.00192 0.51056 0.60966 W_detached -0.00627 0.00188 -3.34136 0.00083 W_no_car 0.00387 0.00217 1.78649 0.07402 W_ln_density 0.01956 0.01786 1.09509 0.27348 W_ln_price 0.70165 0.04983 14.08217 0.00000 ------------------------------------------------------------------------------------ DIAGNOSTICS FOR SPATIAL DEPENDENCE TEST DF VALUE PROB Common Factor Hypothesis Test 4 23.430 0.0001 SPATIAL DURBIN MODEL IMPACTS Impacts computed using the 'full' method. Variable Direct Indirect Total level4 0.0076 0.0178 0.0254 detached 0.0064 -0.0087 -0.0022 no_car -0.0113 -0.0088 -0.0202 ln_density -0.0201 0.0269 0.0068 ================================ END OF REPORT ===================================== === robustness: GM estimators that allow heteroskedasticity === GM_Error_Het GM_Lag level4 GM error (het) +0.0099 (z +6.1) GM lag (White) +0.0117 (z +10.6) detached GM error (het) +0.0043 (z +3.8) GM lag (White) +0.0042 (z +4.2) no_car GM error (het) -0.0110 (z -6.0) GM lag (White) -0.0084 (z -6.2) ln_density GM error (het) -0.0161 (z -1.5) GM lag (White) +0.0104 (z +1.0) GM error lambda 0.761 | GM lag rho 0.397 === model comparison (queen weights) === model logL AIC SC params resid_I resid_p OLS 106.174 -202.347 -183.812 5 0.457 0.000 Spatial lag (ML) 178.284 -344.569 -322.326 6 0.094 0.003 Spatial error (ML) 187.403 -364.806 -346.270 6 -0.074 0.016 Spatial Durbin (ML) 201.027 -382.055 -344.984 10 -0.052 0.077 LR lag vs OLS: 144.2 (df 1, p = 3.2e-33) LR error vs OLS: 162.5 (df 1, p = 3.3e-37) LR Durbin vs lag: 45.5 (df 4, p = 3.2e-09) LR Durbin vs error (common factor): 27.2 (df 4, p = 1.8e-05) === % change in median price for a +1 SD change in each variable === SD: level4 9.68, detached 12.15, no_car 12.04, ln_density 0.99 OLS level4 +17.7% detached +5.1% no_car -12.7% ln_density +0.3% Spatial error level4 +7.9% detached +6.1% no_car -11.9% ln_density -2.0% Spatial lag: direct level4 +10.9% detached +5.7% no_car -9.1% ln_density +1.4% Spatial lag: total level4 +22.9% detached +11.7% no_car -17.3% ln_density +2.7% === sensitivity to the spatial weights === weights mean_nbrs resid_I rLM_lag rLM_err rho lambda AIC_lag AIC_err lag_total_level4 lag_direct_level4 err_level4 err_no_car lag_total_no_car queen 5.7209 0.4570 32.0719 45.9879 0.5284 0.7961 -344.5687 -364.8056 0.0213 0.0107 0.0078 -0.0106 -0.0158 rook 5.7076 0.4579 32.5057 45.6931 0.5298 0.7979 -345.7827 -366.2278 0.0213 0.0107 0.0077 -0.0106 -0.0159 knn4 4.0000 0.4982 21.2865 56.1741 0.4816 0.7340 -330.1602 -354.6328 0.0200 0.0110 0.0083 -0.0103 -0.0147 knn6 6.0000 0.4783 27.1228 89.9285 0.5048 0.7678 -336.1765 -363.2644 0.0215 0.0112 0.0084 -0.0113 -0.0156 knn8 8.0000 0.4595 33.4480 121.8362 0.5443 0.7980 -347.4367 -369.1153 0.0234 0.0111 0.0085 -0.0116 -0.0174 knn12 12.0000 0.4460 30.4394 217.6643 0.5749 0.8417 -346.5446 -380.4566 0.0268 0.0118 0.0085 -0.0124 -0.0201 wrote figures and output/metrics.json