Repository Public Research preview
1===== 05_descriptive_analysis 20:52:10 =====2 File "/opt/homebrew/lib/python3.14/site-packages/pandas/core/frame.py", line 16120, in quantile3 res_df = self.quantile(4 [q], # type: ignore[list-item]5 ...<3 lines>...6 method=method,7 )8 File "/opt/homebrew/lib/python3.14/site-packages/pandas/core/frame.py", line 16165, in quantile9 res = data._mgr.quantile(qs=q, interpolation=interpolation)10 File "/opt/homebrew/lib/python3.14/site-packages/pandas/core/internals/managers.py", line 1720, in quantile11 blk.quantile(qs=qs, interpolation=interpolation) for blk in self.blocks12 ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^13 File "/opt/homebrew/lib/python3.14/site-packages/pandas/core/internals/blocks.py", line 1495, in quantile14 result = quantile_compat(self.values, np.asarray(qs._values), interpolation)15 File "/opt/homebrew/lib/python3.14/site-packages/pandas/core/array_algos/quantile.py", line 39, in quantile_compat16 return quantile_with_mask(values, mask, fill_value, qs, interpolation)17 File "/opt/homebrew/lib/python3.14/site-packages/pandas/core/array_algos/quantile.py", line 97, in quantile_with_mask18 result = _nanquantile(19 values,20 ...<3 lines>...21 interpolation=interpolation,22 )23 File "/opt/homebrew/lib/python3.14/site-packages/pandas/core/array_algos/quantile.py", line 218, in _nanquantile24 return np.quantile(25 ~~~~~~~~~~~^26 values,27 ^^^^^^^28 ...<5 lines>...29 method=interpolation, # type: ignore[call-overload]30 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^31 )32 ^33 File "/opt/homebrew/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py", line 4496, in quantile34 return _quantile_unchecked(35 a, q, axis, out, overwrite_input, method, keepdims, weights, weak_q)36 File "/opt/homebrew/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py", line 4510, in _quantile_unchecked37 return _ureduce(a,38 func=_quantile_ureduce_func,39 ...<6 lines>...40 method=method,41 weak_q=weak_q)42 File "/opt/homebrew/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py", line 3880, in _ureduce43 r = func(a, **kwargs)44 File "/opt/homebrew/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py", line 4669, in _quantile_ureduce_func45 result = _quantile(arr,46 quantiles=q,47 ...<3 lines>...48 weights=wgt,49 weak_q=weak_q)50 File "/opt/homebrew/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py", line 4807, in _quantile51 result = _lerp(previous,52 next,53 gamma,54 out=out)55 File "/opt/homebrew/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py", line 4596, in _lerp56 diff_b_a = b - a57 ~~^~~58TypeError: numpy boolean subtract, the `-` operator, is not supported, use the bitwise_xor, the `^` operator, or the logical_xor function instead.59real 0,4560user 0,3861sys 0,0662exit: 163===== 06_hedonic_models 20:52:10 =====64========================================================================6506 HEDONIC REGRESSION MODELS66========================================================================6768Rent data: 8,303 rows, 43 cols69Airbnb data: 3,456 rows, 21 cols7071------------------------------------------------------------------------72MODEL 1: Baseline Hedonic Rent Model73------------------------------------------------------------------------7475 [1a] N=8,303 R2=0.0075 Adj-R2=0.00747677 [1b] N=7,925 R2=0.4705 Adj-R2=0.47027879 [1c] N=7,925 R2=0.5697 Adj-R2=0.55548081 [1d] N=7,925 R2=0.5697 Adj-R2=0.55548283 [1e] N=4,370 R2=0.4961 Adj-R2=0.485784Traceback (most recent call last):85 File "/Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/scripts/06_hedonic_models.py", line 321, in <module>86 main()87 ~~~~^^88 File "/Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/scripts/06_hedonic_models.py", line 311, in main89 model1_hedonic_rent(rent)90 ~~~~~~~~~~~~~~~~~~~^^^^^^91 File "/Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/scripts/06_hedonic_models.py", line 105, in model1_hedonic_rent92 results_to_latex(93 ~~~~~~~~~~~~~~~~^94 all_res,95 ^^^^^^^^96 ...<5 lines>...97 note="Models (1c)-(1e) include city fixed effects (not shown).",98 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^99 )100 ^101 File "/Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/src/latex_tables.py", line 136, in results_to_latex102 vname = label(var)103 ^^^^^104UnboundLocalError: cannot access local variable 'label' where it is not associated with a value105real 1,04106user 0,93107sys 0,14108exit: 1109===== 07_spatial_models 20:52:11 =====110/Users/simon-pierreboucher/Library/Python/3.14/lib/python/site-packages/libpysal/weights/distance.py:153: UserWarning: The weights matrix is not fully connected: 111 There are 140 disconnected components.112 W.__init__(self, neighbors, id_order=ids, **kwargs)113 libpysal + spreg available — will run SAR / SEM114========================================================================11507 SPATIAL MODELS116========================================================================117118Rent data: 8,303 rows119120------------------------------------------------------------------------121MODEL 4: Spatial Models122------------------------------------------------------------------------123 Complete cases for spatial analysis: 7,925124 [OLS baseline (spatial sample)] N=7,925 R2=0.5081125126 Building KNN(k=5) spatial weights ...127 Estimating Spatial Lag Model (SAR) ...128GM_Lag129 [SAR] N=7925 pseudo-R2=0.5508 rho=0.1340130 Estimating Spatial Error Model (SEM) ...131GM_Error132 [SEM] N=7925 pseudo-R2=0.4973 lambda=0.5437133 Computing LeSage-Pace impacts ...134 rho=0.1340 mean diag exact=1.00258 series=1.00257135 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/spatial_impacts.tex136 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/spatial_models.tex137138------------------------------------------------------------------------139Distance-buffer robustness (250m, 500m, 1km, 2km)140------------------------------------------------------------------------141 [buffer 250m] N=7,925 R2=0.5026142 [buffer 500m] N=7,925 R2=0.5081143 [buffer 1km] N=7,925 R2=0.5167144 [buffer 2km] N=7,925 R2=0.5205145 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/buffer_robustness.tex146 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/coefficient_buffer_comparison.pdf147148========================================================================14907 DONE150========================================================================151real 2,52152user 2,14153sys 0,29154exit: 0155===== 08_quantile_models 20:52:14 =====156========================================================================15708 QUANTILE REGRESSION MODELS158========================================================================159160Rent data: 8,303 rows161 Top-5 cities for quantile FE: ['Montreal', 'Laval', 'Gatineau', 'Trois-Rivières', 'Longueuil']162 Complete cases: 7,925163164------------------------------------------------------------------------165MODEL 5: Quantile Regressions166------------------------------------------------------------------------167 tau=0.10 β(airbnb)=0.003687 SE=0.000323 p=0.0000*** pseudo-R2=0.2251168 tau=0.25 β(airbnb)=0.003426 SE=0.000255 p=0.0000*** pseudo-R2=0.2529169 tau=0.50 β(airbnb)=0.003528 SE=0.000234 p=0.0000*** pseudo-R2=0.2976170 tau=0.75 β(airbnb)=0.004133 SE=0.000228 p=0.0000*** pseudo-R2=0.3294171 tau=0.90 β(airbnb)=0.004715 SE=0.000328 p=0.0000*** pseudo-R2=0.3402172 OLS β(airbnb)=0.003849 SE=0.000221 R2=0.4849173174 Building LaTeX table ...175 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/quantile_regression.tex176 Building coefficient plot ...177 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/quantile_coefficients.pdf178179========================================================================18008 DONE181========================================================================182real 1,60183user 1,42184sys 0,16185exit: 0186===== 09_ml_robustness 20:52:15 =====187Loading data ...188Sample size after dropping NaN: 4,370189Train: 3,496 | Test: 874190Training OLS ...191 R2 train=0.4741 test=0.5094 RMSE=0.2242 MAE=0.1727192Training LASSO ...193 R2 train=0.4740 test=0.5099 RMSE=0.2241 MAE=0.1725194Training Elastic Net ...195 R2 train=0.4740 test=0.5099 RMSE=0.2241 MAE=0.1725196Training Random Forest ...197 R2 train=0.9092 test=0.7079 RMSE=0.1730 MAE=0.1284198Training Gradient Boosting ...199 R2 train=0.8762 test=0.6935 RMSE=0.1772 MAE=0.1319200201Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/ml_comparison.tex202Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/ml_comparison.csv203Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/ml_predicted_vs_actual.pdf204205SHAP library found — computing SHAP values ...206Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/shap_summary.pdf207Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/feature_importance.pdf208209Cross-validation (random vs FSA-blocked folds) ...210 [Random 5-fold] OLS R2=0.4767 (sd 0.0405) RMSE=0.2256211 [Random 5-fold] LASSO R2=0.4767 (sd 0.0406) RMSE=0.2256212 [Random 5-fold] Elastic Net R2=0.4767 (sd 0.0405) RMSE=0.2256213 [Random 5-fold] Random Forest R2=0.6473 (sd 0.0445) RMSE=0.1849214 [Random 5-fold] Gradient Boosting R2=0.6538 (sd 0.0334) RMSE=0.1834215 [Spatial 5-fold (FSA blocks)] OLS R2=0.4667 (sd 0.0539) RMSE=0.2261216 [Spatial 5-fold (FSA blocks)] LASSO R2=0.4668 (sd 0.0538) RMSE=0.2261217 [Spatial 5-fold (FSA blocks)] Elastic Net R2=0.4668 (sd 0.0538) RMSE=0.2261218 [Spatial 5-fold (FSA blocks)] Random Forest R2=0.4307 (sd 0.1594) RMSE=0.2306219 [Spatial 5-fold (FSA blocks)] Gradient Boosting R2=0.4140 (sd 0.1076) RMSE=0.2355220Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/ml_spatial_cv.tex221222=== 09_ml_robustness.py complete ===223real 28,48224user 102,86225sys 2,34226exit: 0227===== 10_robustness_tables_figures 20:52:44 =====228Loading data ...229Full sample: 8,303 observations230231--- Winsorization robustness ---232 Full sample coef=0.003891 N=7925233 Rent winsorized (5/95) coef=0.003057 N=7254234 Airbnb trimmed (1/99) coef=0.004222 N=7868235Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/robustness_outliers.tex236237--- Subsample analysis ---238 Montreal only coef=0.003865 N=4578239 Outside Montreal coef=0.003046 N=3347240 Apartments only coef=0.003860 N=7136241 Houses only coef=0.005857 N=741242Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/robustness_subsamples.tex243244--- Hexbin heatmap (Montreal) ---245Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/rent_airbnb_heatmap.pdf246247--- Coefficient robustness plot ---248Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/coefficient_robustness.pdf249250--- Rent by Airbnb quintiles ---251Saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/rent_by_airbnb_bins.pdf252253=== 10_robustness_tables_figures.py complete ===254real 1,58255user 1,44256sys 0,18257exit: 0258===== 11_extended_robustness 20:52:45 =====259========================================================================26011 EXTENDED ROBUSTNESS261========================================================================262263Sample: 8,303 rows | interior size non-missing: 3,699264265--- Specifications R1-R5 ---266 [R1 baseline HC1] N=7,925 R2=0.5697 beta(airbnb_count_500m)=0.003878 SE=0.000225267 [R2 clustered] city clusters = 252268 [R2 clustered] N=7,925 R2=0.5697 beta(airbnb_count_500m)=0.003878 SE=0.000110269 [R3 + size] N=3,531 R2=0.6044 beta(airbnb_count_500m)=0.003162 SE=0.000275270 [R4 log(1+count)] N=7,925 R2=0.5726 beta(log1p_airbnb_500m)=0.048354 SE=0.002538271 [R5 ring] N=7,925 R2=0.5786 beta(airbnb_count_500m)=0.001280 SE=0.000295272 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/extended_robustness.tex273274--- Leave-one-city-out ---275 [Full sample] N=7,925 R2=0.5697 beta(airbnb_count_500m)=0.003878 SE=0.000225276 [excl. Montreal] N=3,347 R2=0.7062 beta(airbnb_count_500m)=0.003773 SE=0.001639277 [excl. Laval] N=7,534 R2=0.5704 beta(airbnb_count_500m)=0.003880 SE=0.000226278 [excl. Gatineau] N=7,736 R2=0.5721 beta(airbnb_count_500m)=0.003870 SE=0.000225279 [excl. Trois-Rivières] N=7,811 R2=0.5720 beta(airbnb_count_500m)=0.003888 SE=0.000225280 [excl. Longueuil] N=7,757 R2=0.5690 beta(airbnb_count_500m)=0.003889 SE=0.000225281 [excl. Brossard] N=7,771 R2=0.5708 beta(airbnb_count_500m)=0.003883 SE=0.000225282 [excl. Québec] N=7,813 R2=0.5733 beta(airbnb_count_500m)=0.003952 SE=0.000227283 [excl. Salaberry-de-Valleyfield] N=7,816 R2=0.5644 beta(airbnb_count_500m)=0.003874 SE=0.000225284 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/figures/leave_one_city_out.pdf285286========================================================================28711 DONE288========================================================================289real 1,89290user 1,81291sys 0,19292exit: 0293===== 12_neighbourhood_fe_inference 20:52:47 =====294========================================================================29512 NEIGHBOURHOOD FIXED EFFECTS AND SPATIAL INFERENCE296========================================================================297298Sample: 8,303 rows | FSAs: 333 | cities: 253299300--- Specifications ---301 [F1 city FE] N=7,860 groups=187 R2=0.5636 within R2=0.4703 beta(airbnb_count_500m)=0.003878 SE=0.000224302 [F2 FSA FE] N=7,883 groups=289 R2=0.6306 within R2=0.5189 beta(airbnb_count_500m)=0.000819 SE=0.000362303 [F3 FSA FE any+count] N=7,883 groups=289 R2=0.6313 within R2=0.5197 beta(any_airbnb_500m)=-0.027888 SE=0.008775304 [F4 FSA FE log1p] N=7,883 groups=289 R2=0.6303 within R2=0.5184 beta(log1p_airbnb_500m)=0.002230 SE=0.005297305 [F5 FSA FE + size] N=3,485 groups=222 R2=0.6505 within R2=0.5326 beta(airbnb_count_500m)=0.000327 SE=0.000579306 [bivariate] beta=0.001969 R2=0.0075307 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/neighbourhood_fe.tex308309--- Inference comparison ---310 [City FE (Model 1c)] beta=0.003878 HC1=0.000224 city=0.000109 (187 cl.) fsa=0.000654 (318 cl.) Conley1km=0.000689 Conley2km=0.000728 Conley5km=0.000655 Conley10km=0.000721311 [FSA FE (F2)] beta=0.000819 HC1=0.000362 city=0.000359 (239 cl.) fsa=0.000727 (289 cl.) Conley1km=0.000719 Conley2km=0.000684 Conley5km=0.000473 Conley10km=0.000404312 -> saved /Users/simon-pierreboucher/Desktop/Recherche-UQO/immobilier/airbnb-rents-housing-pressure/results/tables/inference_comparison.tex313314========================================================================31512 DONE316========================================================================317real 4,56318user 4,37319sys 0,16320exit: 0321ALL DONE 20:52:52322