This code computes the detour factor for public transport and cars and motorbikes, by distance categories (0.5-5km, 5-10km, 10-25km, 25-50km, 50-75km, 75-100km, 100+km). To know more about the detour factor, check e.g.:
Chalasani, V. Saikumar, O. Engebretsen, et K. W. Axhausen. Precision of Geocoded Locations and Network Distance Estimates. Journal of Transportation and Statistics 8, nᵒ 2 (2005): 15.
This code uses data from the Mobility and Transport Microcensus (MTMC) 2010 and 2015. The results are available as CSV-files. They have also been published on Mastodon in English, French and German and on LinkedIn.
Global correction factor (weighted average): 1.51
Correction factor for cars and motorbikes (weighted average): 1.54
Correction factor for public transport (weighted average): 1.34
Correction factor for bikes (weighted average; careful: not based on routed distances, but on distances estimated by the respondent): 1.70
Correction factor by transport mode and distance categories (weighted average, median & 10th percentile), see CSV-files:
Global correction factor (weighted average): 1.45
Correction factor for cars and motorbikes (weighted average): 1.47
Correction factor for public transport (weighted average): 1.33
Correction factor for bikes (weighted average; careful: not based on routed distances, but on distances estimated by the respondent): 1.61
Correction factor for walking (weighted average; careful: not based on routed distances, but on distances estimated by the respondent): 1.53
Correction factor by transport mode and distance categories (weighted average, median & 10th percentile), see CSV-files:
These instructions will get you a copy of the project up and running on your local machine for reproducing the result and understanding how it has been generated.
To run the code itself, you need python 3, pandas and numpy.
For it to produce the results, you also need the raw data of the Transport and Mobility Microcensus 2010 and 2015, not included on GitHub. These data are individual data and therefore not open. You can however get them by filling in this form in German, French or Italian. The cost of the data is available in the document "Mikrozensus Mobilität und Verkehr 2015: Mögliche Zusatzauswertungen"/"Microrecensement mobilité et transports 2015: Analyses supplémentaires possibles".
Please copy the files etappen.csv from 2010 and etappen.csv from 2015 that you receive from the Swiss Federal Statistical Office (FSO) in the folders "mtmc2010/data/source" and "mtmc2015/data/source" respectively. Then run run_detourfactor.py.
DO NOT commit or share in any way these two CSV-files! These are personal data.