MARG - Mobility Analytics Research Group
  • Home
  • About
    • MARG Team
    • Research and Services
    • Collaborate and Contribute
  • Projects
    • PopGen
    • Vehicle Fleet Mix Model
    • R Codes for Travel Modeling
    • Integrated Model: SimTRAVEL
    • openAMOS
    • University Survey and Model
    • Tour Structure Model
    • Integrated Energy Model
    • Wellbeing Estimator
  • FOSS-TM
  • Contact
    • Guestbook

R Codes for Travel Modeling

Code for Model Estimation and Application

In the context of a number of research projects, the Mobility Analytics Research Group (MARG) has developed a number of codes in the open source R programming language.  MARG is pleased to make these codes available through this website.  The bank of R codes will likely be expanded as the group undertakes additional research projects that involve model estimation and application tasks. The Mobility Analytics Research Group does not plan to develop a comprehensive suite of model codes; packages such as GAUSS, Matlab, NLOGIT, Biogeme, ALOGIT, and others provide far more extensive model estimation and application capabilities.  In addition, Professor Chandra Bhat has made a number of advanced choice model estimation and application codes (programmed in GAUSS and R) available at his website. Individuals, groups, or organizations interested in contributing further to the bank of R codes available at this site are welcome to contact the Mobility Analytics Research Group team.  Please cite this webpage (along with other references cited below) in any work that utilizes the R codes made available through this site.  This website should be cited as follows:
  • MARG (2016) R Codes for Travel Modeling [online]. Mobility Analytics Research Group. Available at:    http://www.mobilityanalytics.org/r-codes-for-travel-modeling.html​, Accessed [Date of Access].  

Basic Models: Regression and Discrete Choice

Basic Regression and Discrete Choice (.zip)
File Size: 181 kb
File Type: zip
Download File

This code covers basic linear regression, count regression models (poisson and negative binomial), zero-inflated versions of poisson and negative binomial regression models, ordered probit, and multinomial logit (accommodates both generic and alternative-specific variables, but not variable choice sets across observations) models.  

Halton Sequence Generation

Halton Sequence (.zip)
File Size: 5204 kb
File Type: zip
Download File

This code may be used to generate a Halton Sequence for simulation-based model estimation and application.  The Halton Sequence provides the ability to accurately and rapidly evaluate multi-dimensional integrals where no analytical closed form solution exists. Please cite:  Bhat, C.R. (2003) Simulation Estimation of Mixed Discrete Choice Models Using Randomized and Scrambled Halton Sequences. Transportation Research Part B, 37(9), pp. 837-855.  Also see Professor Bhat's Halton Sequence code in GAUSS. 

MDCEV Model Estimation

MDCEV Estimation_No Outside Good (.zip)
File Size: 279 kb
File Type: zip
Download File

MDCEV Estimation_With Outside Good (.zip)
File Size: 1227 kb
File Type: zip
Download File

This code may be used to estimate the multiple discrete-continuous extreme value (MDCEV) model.  There are two versions of the model, one in which the choice set includes an outside good that is consumed at least to some degree by all observations in the data set, and the second in which the choice set does not include such an outside good.  Both codes may be used to estimate either an alpha or a gamma profile of the MDCEV model.  These R codes are entirely based on the GAUSS codes developed by Professor Chandra Bhat's research group. Please cite the following papers: 
  • Bhat, C.R. (2008) The Multiple Discrete-Continuous Extreme Value (MDCEV) Model: Role of Utility Function Parameters, Identification Considerations, and Model Extensions. Transportation Research Part B, 42(3), pp. 274-303.  
  • Bhat, C.R. (2005) A Multiple Discrete-Continuous Extreme Value Model: Formulation and Application to Discretionary Time Use Decisions. Transportation Research Part B, 39(8), pp. 679-707.
Also, see Professor Bhat's MDCEV model estimation codes in GAUSS. 
For a nested version of the MDCEV model, please refer to the following paper and the corresponding GAUSS code:
  • ​Pinjari A.R. and C.R. Bhat (2010) A Multiple Discrete-Continuous Nested Extreme Value (MDCNEV) Model: Formulation and Application to Non-worker Activity Time-use and Timing Behavior on Weekdays. Transportation Research Part B, 44(4), 562-583. 

MDCEV Model Application

MDCEVForecasting_NoOutside (.zip)
File Size: 194 kb
File Type: zip
Download File

MDCEVForecasting_WithOutside (.zip)
File Size: 174 kb
File Type: zip
Download File

The MDCEV model application code may be used to calibrate, validate, and apply MDCEV models in forecasting mode.  There are two versions of the MDCEV forecasting code - one in which the choice set includes an outside good that is consumed at least to some degree by all observations in the data set, and the second in which the choice set does not include such an outside good.  The codes may be used to apply both alpha-profile and gamma-profile versions of the MDCEV model.  These R codes are entirely based on the GAUSS codes developed by Professor Chandra Bhat's research group. Please cite the following paper, in addition to the two papers referenced above in the context of the MDCEV model estimation code: 
  • Pinjari, A.R., and C.R. Bhat (2011) Computationally Efficient Forecasting Procedures for Kuhn-Tucker Consumer Demand Model Systems: Application to Residential Energy Consumption Analysis. Technical paper, Department of Civil & Environmental Engineering, University of South Florida, Tampa, FL. 
​Also, see Professor Bhat's MDCEV model application/forecasting codes in GAUSS. 
© COPYRIGHT 2016. ALL RIGHTS RESERVED.
  • Home
  • About
    • MARG Team
    • Research and Services
    • Collaborate and Contribute
  • Projects
    • PopGen
    • Vehicle Fleet Mix Model
    • R Codes for Travel Modeling
    • Integrated Model: SimTRAVEL
    • openAMOS
    • University Survey and Model
    • Tour Structure Model
    • Integrated Energy Model
    • Wellbeing Estimator
  • FOSS-TM
  • Contact
    • Guestbook