National Academies Press: OpenBook

New Mobility Options in Travel Demand Forecasting and Modeling: A Guide (2024)

Chapter: Appendix - Step-by-Step Notes on Running the R Codes with Data

« Previous: References
Page 25
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 25
Page 26
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 26
Page 27
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 27
Page 28
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 28
Page 29
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 29
Page 30
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 30
Page 31
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 31
Page 32
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 32
Page 33
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 33
Page 34
Suggested Citation:"Appendix - Step-by-Step Notes on Running the R Codes with Data." National Academies of Sciences, Engineering, and Medicine. 2024. New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. Washington, DC: The National Academies Press. doi: 10.17226/27827.
×
Page 34

Below is the uncorrected machine-read text of this chapter, intended to provide our own search engines and external engines with highly rich, chapter-representative searchable text of each book. Because it is UNCORRECTED material, please consider the following text as a useful but insufficient proxy for the authoritative book pages.

25   Step-by-Step Notes on Running the R Codes with Data A P P E N D I X This appendix provides a step-by-step tutorial on executing the codes developed in the Apollo Choice Modeling framework with R. The R notebooks were prepared for all models included in the guide. Datasets, codes, and tutorials are also available for three use cases: (1) household vehicle ownership, (2) household trip rates, and (3) mode choice. For each use case, datasets are in CSV format, code is available as R codes, and tutorials are available for a base model, NMO model, and a random scenario model. These supporting files are available on the National Academies Press website (nap.nationalacademies.org) by searching for NCHRP Research Report 1113: New Mobility Options in Travel Demand Forecasting and Modeling: A Guide. In the example in this appendix, four vehicle ownership levels are considered: households with zero vehicles, households with one vehicle, households with two vehicles, and households with three or more vehicles. Step 0 R is a programming language for statistical computing and graphics. The installation files required to install R can be found at the following link: https://posit.co/download/rstudio-desktop/ Step 1 First, after installing the software successfully, open the R application. After that, remove objects from the workspace and clear the memory and then install the “Apollo” package using the following command: install.packages(“apollo”) After that, load “apollo” library.

26 New Mobility Options in Travel Demand Forecasting and Modeling: A Guide Step 2 Second, initialize the Apollo Choice Modeling framework by specifying the model name and description and setting the output directory. Each individual record in the dataset has been assigned to a unique identifier, which is represented by the variable “id” in the dataset and provided here in the box marked red. Step 3 Third, load the dataset in csv format and check the descriptive statistics of each variable included in the dataset and frequency of the dependent variable “Choice.”

Step-by-Step Notes on Running the R Codes with Data 27   Here, Choice = Vehicle ownership level veh0 = zero-vehicle HHs veh1 = HHs with one vehicle veh2= HHs with two vehicles veh3 = HHs with three or more vehicles wrktodrv = Ratio of workers to drivers age615todrv = Ratio of people aged 6–15 to drivers age1824todrv = Ratio of people aged 18–24 to drivers age80todrv = Ratio of people aged 80 or older to drivers inc_10 = HH income <= $10,000 inc_1030 = $10,000 < HH income <= $30,000 inc_60100 = $60,000 < HH income <= $100,000 Here, 1 = HHs with zero vehicles 2 = HHs with one vehicle 3 = HHs with two vehicles 4 = HHs with three or more vehicles

28 New Mobility Options in Travel Demand Forecasting and Modeling: A Guide Step 4 Fourth, set the initial values for the vector of parameters that will be estimated during the model estimation process. Each element in this vector corresponds to a specific parameter in the choice model framework. Fixed parameters must be included here as well (if any). Use the “apollo_fixed” function to fix the value of the parameter(s). Vectors with name(s) (in quotes) of parameter(s) are to be kept fixed at the starting value in apollo_beta; use apollo_fixed = c() if none. For example, in the red box in the illustration that follows, the researchers have fixed the parameter “asc_veh3” to zero. Here, asc_veh3 = Alternative specific constant for HHs with three or more vehicles asc_veh2 = Alternative specific constant for HHs with two vehicles asc_veh1 = Alternative specific constant for HHs with one vehicle asc_veh0 = Alternative specific constant for HHs with zero vehicles b_wrktodrv_veh1 = Coefficient for ratio of workers to drivers (HHs with one vehicle) b_wrktodrv_veh0 = Coefficient for ratio of workers to drivers (zero-vehicle HHs) b_615todrv_veh2 = Coefficient for ratio of people aged 6–15 to drivers (HHs with two or more vehicles) b_615todrv_veh1 = Coefficient for ratio of people aged 6–15 to drivers (HHs with one vehicle) b_1824todrv_veh2 = Coefficient for ratio of people aged 18–24 to drivers (HHs with two or more vehicles) b_1824todrv_veh1 = Coefficient for ratio of people aged 18–24 to drivers to drivers (HHs with one vehicle) b_1824todrv_veh0 = Coefficient for ratio of people aged 18–24 to drivers to drivers (HHs with zero vehicles)

Step-by-Step Notes on Running the R Codes with Data 29   b_80todrv_veh1 = Coefficient for ratio of people aged 80 or older to drivers to drivers (HHs with one vehicle) b_inc10_veh2 = Coefficient for household income <=$10,000 (HHs with two vehicles) b_inc10_veh1 = Coefficient for household income <=$10,000 (HHs with one vehicle) b_inc10_veh0 = Coefficient for household income <=$10,000 (zero-vehicle HHs) b_inc1030_veh2 = Coefficient for $10,000 < household income <= $30,000 (HHs with two vehicles) b_inc1030_veh1 = Coefficient for $10,000 < household income <= $30,000 (HHs with one vehicle) b_inc1030_veh0 = Coefficient for $10,000 < household income <= $30,000 (zero-vehicle HHs) b_inc3060_veh2 = Coefficient for $30,000 < household income <= $60,000 (HHs with two vehicles) b_inc3060_veh1 = Coefficient for $30,000 < household income <= $60,000 (HHs with one vehicle) b_inc3060_veh0 = Coefficient for $30,000 < household income <= $60,000 (zero-vehicle HHs) b_nmo_veh2 = Coefficient for NMO availability indicator (urban household indicator) (HHs with two vehicles) b_inc60100_veh1 = Coefficient for $60,000 < household income <= $100,000 (HHs with one vehicle) b_inc60100_veh0 = Coefficient for $60,000 < household income <= $100,000 (zero-vehicle HHs) Step 5 Fifth, define the utility equation for each alternative. In this example, households with three or more vehicles are considered the base. Hence, the utility equations for other three alternatives need to be defined. The utility equations are defined in the red box in the illustration that follows. In the green box in the illustration, The “alternative” function defines the names of the alternatives. The “avail” function lists the availability matrix. In this example, the availability for each alternative is assigned to 1 by the variable “uno.” The “choiceVar” function defines the dependent variable. The term “utilities” indicates the utility equations.

30 New Mobility Options in Travel Demand Forecasting and Modeling: A Guide Step 6 Sixth, execute the model estimation procedure.

Step-by-Step Notes on Running the R Codes with Data 31   Step 7 Finally, model outputs are generated by the following command. The outputs will match the estimates shown in Table 3.4 of the guide.

32 New Mobility Options in Travel Demand Forecasting and Modeling: A Guide

Abbreviations and acronyms used without de nitions in TRB publications: A4A Airlines for America AAAE American Association of Airport Executives AASHO American Association of State Highway Officials AASHTO American Association of State Highway and Transportation Officials ACI–NA Airports Council International–North America ACRP Airport Cooperative Research Program ADA Americans with Disabilities Act APTA American Public Transportation Association ASCE American Society of Civil Engineers ASME American Society of Mechanical Engineers ASTM American Society for Testing and Materials ATA American Trucking Associations CTAA Community Transportation Association of America CTBSSP Commercial Truck and Bus Safety Synthesis Program DHS Department of Homeland Security DOE Department of Energy EPA Environmental Protection Agency FAA Federal Aviation Administration FAST Fixing America’s Surface Transportation Act (2015) FHWA Federal Highway Administration FMCSA Federal Motor Carrier Safety Administration FRA Federal Railroad Administration FTA Federal Transit Administration GHSA Governors Highway Safety Association HMCRP Hazardous Materials Cooperative Research Program IEEE Institute of Electrical and Electronics Engineers ISTEA Intermodal Surface Transportation Efficiency Act of 1991 ITE Institute of Transportation Engineers MAP-21 Moving Ahead for Progress in the 21st Century Act (2012) NASA National Aeronautics and Space Administration NASAO National Association of State Aviation Officials NCFRP National Cooperative Freight Research Program NCHRP National Cooperative Highway Research Program NHTSA National Highway Traffic Safety Administration NTSB National Transportation Safety Board PHMSA Pipeline and Hazardous Materials Safety Administration RITA Research and Innovative Technology Administration SAE Society of Automotive Engineers SAFETEA-LU Safe, Accountable, Flexible, Efficient Transportation Equity Act: A Legacy for Users (2005) TCRP Transit Cooperative Research Program TEA-21 Transportation Equity Act for the 21st Century (1998) TRB Transportation Research Board TSA Transportation Security Administration U.S. DOT United States Department of Transportation

Transportation Research Board 500 Fifth Street, NW Washington, DC 20001 ADDRESS SERVICE REQUESTED ISBN 978-0-309-70982-8 9 7 8 0 3 0 9 7 0 9 8 2 8 9 0 0 0 0

New Mobility Options in Travel Demand Forecasting and Modeling: A Guide Get This Book
×
 New Mobility Options in Travel Demand Forecasting and Modeling: A Guide
Buy Paperback | $62.00
MyNAP members save 10% online.
Login or Register to save!
Download Free PDF

Emerging transportation technologies and shared mobility services, or new mobility options (NMOs), are affecting travel behavior and demand. NMOs may include shared micromobility, transportation networking companies (TNCs), and connected and autonomous vehicles (CAVs). As NMOs grow in availability and use, transportation planners and decision-makers need to be able to understand how to harness positive and mitigate negative impacts.

NCHRP Research Report 1113: New Mobility Options in Travel Demand Forecasting and Modeling: A Guide, from TRB's National Cooperative Highway Research Program, provides travel demand modeling practitioners with ways to consider NMOs in travel demand forecasting models (TDFMs) - one of the primary tools available to understand potential impacts and future uncertainties.

Supplemental to the report are NCHRP Web-Only Document 399: Developing a Guide for New Mobility Options in Travel Demand Forecasting and Modeling; datasets of Use Case 1: Data, Code, and Tutorials for Household Vehicle Ownership Use Case; Use Case 2: Data, Code, and Tutorials for Household Trip Rates Use Case; Use Case 3: Data, Code, and Tutorials for Mode Choice Use Case; an Implementation of Research Findings and Products document; and a PowerPoint presentation of the research.

Any software included is offered as is, without warranty or promise of support of any kind either expressed or implied. Under no circumstance will the National Academy of Sciences or the Transportation Research Board (collectively “TRB”) be liable for any loss or damage caused by the installation or operation of this product. TRB makes no representation or warranty of any kind, expressed or implied, in fact or in law, including without limitation, the warranty of merchantability or the warranty of fitness for a particular purpose, and shall not in any case be liable for any consequential or special damages.

READ FREE ONLINE

  1. ×

    Welcome to OpenBook!

    You're looking at OpenBook, NAP.edu's online reading room since 1999. Based on feedback from you, our users, we've made some improvements that make it easier than ever to read thousands of publications on our website.

    Do you want to take a quick tour of the OpenBook's features?

    No Thanks Take a Tour »
  2. ×

    Show this book's table of contents, where you can jump to any chapter by name.

    « Back Next »
  3. ×

    ...or use these buttons to go back to the previous chapter or skip to the next one.

    « Back Next »
  4. ×

    Jump up to the previous page or down to the next one. Also, you can type in a page number and press Enter to go directly to that page in the book.

    « Back Next »
  5. ×

    To search the entire text of this book, type in your search term here and press Enter.

    « Back Next »
  6. ×

    Share a link to this book page on your preferred social network or via email.

    « Back Next »
  7. ×

    View our suggested citation for this chapter.

    « Back Next »
  8. ×

    Ready to take your reading offline? Click here to buy this book in print or download it as a free PDF, if available.

    « Back Next »
Stay Connected!