This repository serves as the upstream data source for all Canadian Housing Observatory repositories and releases.
git clone git@github.com:mlian031/canhopi.git
cd canhopi
R -q -e 'renv::restore()'Raw input files are intentionally kept out of version control because some of the source files exceed GitHub's 100 MB per-file limit.
Before running the project, download the relevant data from CREA MLS and Statistics Canada and place them at these exact paths (we will try and get a version that ingests via API up soon!):
data/
crea/
MLS_HPI_March_2026/
Not Seasonally Adjusted (A).xlsx
Not Seasonally Adjusted (M).xlsx
Not Seasonally Adjusted (Q).xlsx
Seasonally Adjusted (M).xlsx
statscan/
11100190/
11100190.csv
11100190_MetaData.csv
18100004/
18100004.csv
18100004_MetaData.csv
34100133/
34100133.csv
34100133_MetaData.csv
MLS_HPI_March_2026 corresponds to CREA MLS Home Price Index
11100190 corresponds to Table 11-10-0190-01, Market income, government transfers, total income, income tax and after-tax income by economic family type.
18100004 corresponds to Table 18-10-0004-01, Consumer Price Index, monthly, not seasonally adjusted.
34100133 corresponds to Table 34-10-0133-01, Canada Mortgage and Housing Corporation, average rents for areas with a population of 10,000 and over.
All analysis code lives under R/.
Intermediate steps can be run in any order once inputs exist; the final step must be last.
R/income.Rbuilds median total income panels (provinces and metropolitan) and saves the intermediate output objects tooutput/.R/rent.Rbuilds a metropolitan two-bedroom rent panel (2023 real dollars) and saves the intermediate output objects tooutput/.R/crea.Rbuilds a CREA MLS house price benchmark panels (provinces and metropolitan, 2023 real dollars) and saves the intermediate output objects tooutput/.R/join_panel.Rmerges the above into the published provincial and metropolitan panels (and CSV exports).R/bsadf.Rcomputes Backward Supremum ADF (BSADF) paths and generalized SADF (GSADF) test-statistic summaries for each region’s series, usingexuber. Requiresoutput/prov_panel.rdsandoutput/metro_panel.rdsfrom step 4.
From the repository root for example:
Rscript R/income.R
Rscript R/rent.R
Rscript R/crea.R
Rscript R/join_panel.R
Rscript R/bsadf.R| File | Role |
|---|---|
R/lookups.R |
Shared province_lookup and metro_lookup tables so CREA region names align with Statistics Canada geography labels used in the Statistics Canada tables. |
R/cpi_helper.R |
build_monthly_cpi_dfltr() for monthly series (CREA) and build_annual_cpi_dfltr() for annual series, using table 18-10-0004-01 (All-items CPI, 2002=100). Real-dollar base year is 2023 in the current code to match with the income data dollars. |
| File | Description |
|---|---|
output/prov_med_income.rds |
Provincial median income (annual). |
output/metro_med_income.rds |
Metropolitan median income (annual). |
output/metro_rent.rds |
Metropolitan two-bedroom rent (annual, real 2023$). |
output/prov_crea_series.rds |
Provincial CREA benchmarks (monthly, real 2023$). |
output/metro_crea_series.rds |
Metropolitan CREA benchmarks (monthly, real 2023$). |
output/prov_panel.rds / output/provincial_panel.csv |
Final provincial panel and CSV export, long format. |
output/metro_panel.rds / output/metro_panel.csv |
Final metropolitan panel and CSV export, long format. |
output/bsadf/prov_bubble_paths.rds / output/bsadf/prov_bubble_paths.csv |
Provincial BSADF paths, critical values, and exuberance flags (95% level) per date. |
output/bsadf/metro_bubble_paths.rds / output/bsadf/metro_bubble_paths.csv |
Metropolitan BSADF paths. |
output/bsadf/prov_bubble_summary.rds / output/bsadf/prov_bubble_summary.csv |
Provincial GSADF statistics and critical values per region. |
output/bsadf/metro_bubble_summary.rds / output/bsadf/metro_bubble_summary.csv |
Metropolitan GSADF summaries. |
Maintainer: Mike Liang (mlian031@uottawa.ca)
Issues: Report here
We thank the Dallas Federal Reserve, Lancaster University Management School (LUMS), International and UK Housing Observatory for inspiring this work.