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 denitions 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