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.
17Â Â The project team developed an R Shiny (https://shiny.rstudio.com/) web-based application for generating the QIE variables and predicting crashes by severity using one of the three new modeling approaches. Shiny is an open-source R package that provides a framework for building web applications using R. The advantages of developing an R Shiny application include (1)Â R is a modern data science tool that is widely accepted by researchers and practitioners, (2)Â it is easier to develop an R application with it than with some other applications, (3) the user interface can be made simple and easy to use, (4) it is less error-prone compared to some other tools with copying and pasting maneuvers, (5) the same level of flexibility such as allowing users to input their own data files and parameter files can be provided, and (6) the QIE data generation step cannot be implemented in some other applications. Consequently, adding the crash prediction step and making it an all-in-one solution is convenient to end-users. Steps to use the tool are presented in the following. 3.1 Access the Tool The application is available for download as a ZIP file on the National Academies Press website (nap.nationalacademies.org) by searching for NCHRP Research Report 1047: Development and Application of Crash Severity Models for Highway Safety. The user will need a browser installed to access the URL (e.g., Microsoft Edge, Chrome, Firefox, or Safari). Once the files are unzipped, please refer to the installation instructions in the âDesktop_Software_Tool_Instructions.docxâ file. Once installed, you will see four tabs in the navigation bar: the âHomeâ page, the âGenerate QIE Variablesâ page, the âPredict Crashes by Severityâ page, and the âRead More â Model Speci- ficationsâ page. The âHomeâ page introduces the objectives of the project, as shown in Figure 3-1. 3.2 Introduction of the QIE Step On the âGenerate QIE Variablesâ page, the QIE method is first introduced, and a working area is provided to import data and run the QIE process, as presented in Figure 3-2 and Figure 3-3. C H A P T E R 3 Introduction to the Tool
Figure 3-1. Home page.
Figure 3-2. Introduction of the QIE method.
Figure 3-3. Working area for generating QIE variables.
Introduction to the Tool 21Â Â To run the QIE process, choose a QIE roadway file and a QIE driver file from your computer to import, as shown in Figure 3-4. The input files must conform to the requirements as discussed in Section 3.1. The files are required to be in comma-separated values (i.e., csv) format. File names can be anything the user chooses, conforming to system specifications. A sample roadway file and driver file can be downloaded by clicking âDownload A Sample QIE Roadway Fileâ and âDownload A Sample QIE Driver File.â Once the input files are uploaded, as shown in Figure 3-5, click the âGenerate QIE Variablesâ button to get the process running. Note that depending on the size of the input files, this process may take some time to run. The generated QIE variables will be appended to the input roadway file and downloaded automatically to your âDownloadâ folder once the process is completed. Please do not leave the webpage while waiting for the process to complete. The downloaded file has a name starting with âQIE_data_â and ending with the date of the run. It is recommended that you immediately rename this file if you wish to archive it. Figure 3-6 presents a sample result of the input files. Figure 3-4. Importing roadway and driver files. Figure 3-5. Run the QIE process.
22 Development and Application of Crash Severity Models for Highway Safety: User Guidelines 3.3 Introduction of the Crash Prediction Step On the âPredict Crashes by Severityâ page, the facility types implemented in this tool and the default recommended modeling frameworks for each facility type are first introduced, and a working area is provided to import data and run the crash prediction process, as presented in Figure 3-7 and Figure 3-8. Figure 3-6. Example result of the QIE process.
Figure 3-7. Introduction of the facility types and models.
24 Development and Application of Crash Severity Models for Highway Safety: User Guidelines Figure 3-8. Working area for predicting crashes by facility types. Figure 3-9. Select a facility type. Step 1: Select a Facility Type To predict crashes by severity using the modeling frameworks recommended in this project, four to six steps are required, depending on the framework developed for the facility type. The first step is to select a facility type, as shown in Figure 3-9. The recommended modeling frame- work for each facility type as introduced in Chapter 2 of this guide was implemented.
Introduction to the Tool 25Â Â Step 3: Import Your Roadway File The third step is to import the crash prediction roadway file (denoted as RoadFile2 in Fig- ure 1-1), as shown in Figure 3-11. Note that this file needs to include the QIE variables, either generated from the QIE step or collected through other sources. The input file needs to meet the requirements as discussed in Section 3.2 of this guide. You can download a sample roadway file by clicking âDownload A Sample Roadway File.â Figure 3-10. Select number of years crashes to predict. Figure 3-11. Import the roadway file with QIE variables. Step 2: Select Number of Years of Crashes to Predict The second step is to select the number of years of crashes to predict, as shown in Figure 3-10. By default, 1 year of crashes will be predicted. The predicted total crashes or crashes by severity levels in the output file are aggregated into the selected number of years.
26 Development and Application of Crash Severity Models for Highway Safety: User Guidelines Figure 3-12. Import or use default parameter estimates. Step 4 and More: Import Your Parameter Estimates Files This step is where users are given the opportunity to either use the default parameter estimates (model coefficients) or provide their own model coefficients. Most users will want to check the box at the top of the input area and use the default coefficients, as shown in Figure 3-12, where it says: âTo use the default parameter estimates check this box.â If the box is checked, the input module for the parameter file will be hidden. The default coefficient file can be downloaded by clicking âDownload the Default Coefficient File.â If users prefer to use parameters that were estimated for their jurisdiction, the input param- eter file must meet the requirements as discussed in Section 3.2. Depending on the facility type selected (and thus the default recommended model selected), different types of input files will be required. For instance, if any of the multilane rural facility types is selected, the multilevel model is recommended. This modeling framework requires three separate parameter estimate filesâone for the univariate count model, one for the connection model, and another for the discrete outcome modelâas shown in Figure 3-13. If users wish to change what they have already entered, the input files can be cleared by clicking the âClear the Input or Default Filesâ button (see Figure 3-14). This will clear the files imported or selected in Step 3 and Step 4. Once the roadway file and the parameter files are imported, the âSummary of Input Vari- ablesâ will display the names of the variables (variables that start with âVar_â) in both files. If the variable names from the roadway file match exactly with the parameter files, a message will say âGood job! The roadway file contains all columns needed for matching with the parameter files!â as shown in Figure 3-15. If the variable names do not match, or variable names in the parameter files are missing from the roadway file, a message will say âError: the roadway file does not contain all columns needed for matching with all the parameter files. Please make sure the column names starting with âVar_â in both files match exactly!â as shown in Figure 3-16.
Figure 3-13. Parameter files required for the multilevel modeling framework. Figure 3-14. Clear the input files.
28 Development and Application of Crash Severity Models for Highway Safety: User Guidelines Figure 3-15. Summary of input variables if match. Figure 3-16. Summary of input variables if not match. If the variable names do not match, please check, modify, and make sure the names match exactly, then clear the input les and upload them again. Please note that the models estimated for this project only include the variables listed in this report. If a jurisdiction has additional input variables, they will not be needed for applying the project models. If they are le in the input le, they will be ignored by the soware tool. If a user wants to use any additional variables for crash prediction, they have to estimate their own models that use those variables. e tool is designed to be exible about permitting a user to dene their own variables as long as the user can also provide a set of coecients for those variables. If the variable names match exactly, you will see the âDownload Outputâ section appear on the screen, as shown in Figure 3-17. Click the âRun the prediction processesâ button to get the prediction model running. It usually only takes a few seconds to generate the predictions, and the output le will be downloaded automatically. A sample output form from the rural two-lane highway segment model is presented in Fig- ure 3-18. (Column names are highlighted in yellow here for demonstration purposes; they are
Figure 3-17. Download the output.
Figure 3-18. Prediction output from the rural two-lane highway segment model (univariate).
Introduction to the Tool 31  not highlighted in your downloaded output file.) Note that the raw predictions directly coming out of the models, the calibration factors, and the predictions with the calibration factors applied are all preserved in the output. Calibration factors should be calculated whenever the models are applied to a dataset that has a different time period or is from a different region. If, for some reason, users decide not to use the calibration factors automatically calculated from the tool, they may refer to the prediction values without calibration in the output. The rules that follow are used in the tool for calculating the calibration factors: ⢠Calibration is done at the end by injury severity levels. ⢠A threshold of a minimum of 30 crashes is used for determining whether there are sufficient data for calculating calibration factors: â If at least 30 crashes are observed for each severity level, then five individual calibration factors (by severity level) are calculated. â If fewer than 30 crashes are observed for O crashes, then a single KABCO calibration factor is calculated and applied to each of the five severity levels. â If at least 30 crashes are observed for O crashes, but fewer than 30 crashes are observed for C crashes, then a calibration factor for O and a calibration factor for KABC are calculated. â If at least 30 crashes are observed for O and C crashes separately, but fewer than 30 crashes are observed for B crashes, then a calibration factor for O, a calibration factor for C, and a calibration factor for KAB are calculated. â If at least 30 crashes are observed for O, C, and B crashes separately, but fewer than 30 crashes are observed for A crashes or K crashes separately, then a calibration factor for O, a calibra- tion factor for C, a calibration factor for B, and a calibration factor for KA are calculated.