An Interactive R Shiny Application for Calculating Monetary Value of Emissions and Accidents

Emission and Accident Costs of Truck and Rail Freight Transportation

Huajing Shi
May 3 · 11 min read
Photo by Micheile Henderson on Unsplash

The economy depends on the efficient movement of freight. There is a strong correlation, between truck and rail ton-miles of travel and real gross domestic product (REF). However, to varying degrees, freight transportation services generate costs that are borne by others. These costs are generally referred as external costs.

External transportation costs are costs generated by transport users and not paid by them but by society as a whole, such as the costs of emissions, accidents, noise and congestion. Ideally each unit of transportation service used (e.g., a ton-mile of freight) could be assigned a price that would reflect the full incremental cost to society of that unit of consumption.

In this article we would focus on two external costs, i.e., emission costs and accident costs for truck and rail freight transport. Accurate monetary estimates of emission and accident costs have been difficult to obtain. To place these costs in a useful context, we would also calculate the pavement damage costs generated from truck modal, and the transportation costs that directly charged for the transportation service.

In general, rail and truck compete in markets involving distances that are relatively short for rail yet relatively long for truck. Most often, the value of freight shipped by truck is higher than that shipped by rail, but the weight shipped by rail is higher than that shipped by truck.

The extent of any shift in modally competitive freight in a given market would depend on many factors, such as relative prices, quality of service, the extent to which the two modes are able to serve the same markets, and specific shipper requirements, among others. The change in modal share can only be speculated on, and it is not our objective to argue for greater use of one mode or another.

Application Design

A R-Shiny application is developed to calculate the monetary value of emission and accident costs on selected origin/destination routes for truck and rail freight transport.

R Shiny Application (Image by Author)

The first part of this application includes using a map to interactively select an origin-destination zone pair and get the freight volume data such as tons, ton-miles from Freight Analysis Framework (FAF) database.

The second part of this application calculates the monetary value of emission and accident costs generated from transporting the amount of FAF-based freight volume between the selected origin-destination zone pair, by truck and rail.

Please refer to the following article for a brief introduction to R Shiny applications and the detailed step by step explanation for implementing the first part of this application.

In this article, we would focus on the second part of the application. The methodology and input parameters used for calculating each type of costs are explained in detail in the following sessions. To keep this article brief, we would only walk through the R codes for implementing the calculation of Emission Costs. The R codes and data for the full implementation are available here.

The method for calculating these costs is adapted from the Excel based Benefit-Cost Analysis (BCA) from Kansas Department of Transportation. This BCA tool is used for evaluating rehabilitation and construction projects in Kansas.

Emission Costs

Transportation activities generate significant quantities of emissions that can affect global climate, harms human health, damages materials, reduces visibility, and stresses crops and forests. These emissions include carbon dioxide (CO2), nitrogen dioxide (NO2), sulfur dioxide (SO2), volatile organic compounds (VOCs), various forms of particulate matter (PM), and etc.

While not technically air pollution, greenhouse gas emissions constitute a threat to society by contributing to global climate change. Carbon dioxide (CO2 ) is by far the most prominent greenhouse gas released by human activities.

Medium- and heavy-duty trucks make up only 5 percent of vehicles on the road but account for about 20 percent of U.S. transportation emissions (REF).

Emissions costs are calculated from:

  • the dollar value of damage associated with a unit of various emissions
  • the emissions factors, i.e., the amount of emissions generated from a unit of travel by different types of vehicles operating under different conditions
  • the total quantities of travel, i.e., vehicle miles traveled and ton-miles traveled

Emission Factors

The value of Emission factors are obtained from EPA’s Motor Vehicle Emission Simulator (MOVES), which serves as the federal regulatory model for mobile-source emission inventories.

MOVES is a state-of-the-science emission modeling system. It provides estimates of emissions for mobile sources at the national, county, and project level for criteria air pollutants, greenhouse gases, and air toxics (REF). MOVES’s estimates are based on analyses of millions of emission test results and account for national emission standards, vehicle populations and activity, state and local rules, fuels, temperatures & humidity.

For most application purposes, emission factors represent the average emissions for all emitting processes of similar design and characteristics (REF). These MOVES-based emission factors are specified separately for gasoline and diesel vehicles, by model year and by vehicle age. They are usually expressed as the weight of emissions divided by a unit weight, volume, distance, or duration of the activity generating the emissions.

The values of rail emission factors or rates depend on freight train configurations (mixed freight, intermodal, and double-stack), trailing tonnage, speed, and etc.

The values of truck emission factors or rates depends on the assumptions regarding truck configurations, operating circumstances such as topography, and travel speeds, and the amount of stop-and-go driving. In the application scenario where truck and rail are competitive modals for one specific origin-destination market, using the emission factors for long distance heavy duty diesel trucks traveling at 55 mph (a common cruising speed) may be appropriate.

When we use emission factors, it is important that we consider the impact of the reliability of emission factors for the specific projects under evaluation. For instance, the truck emission rates listed in Table 1 are selected for the short haul trucks in the climate of Johnson County, Kansas.

Users of emissions factors are advised to conduct periodic retesting to confirm or revise as necessary, the values of the emissions factors.

Emission Cost Calculation

Emission factor values are first calculated based on fuel consumption and fuel properties (i.e., fuel density and carbon content) at gram per gallon. These values are then converted to gram per ton-mile based on fuel efficiency.

Now we use the emission factors (grams/ton-mile) and the freight volumes (in ton-miles) to calculate the total amount of emissions, which then multiply to the emission cost rates ($/ton) to arrive at the total emission costs.

Emission Cost = (Emissions Cost Rate) × (Emission Quantity)

Emission Quantity = (Emission Rate) × (Ton-Miles)

The input parameters to the emission cost model include emission factor (or emission rate) and emission cost. The emission rates are different for rail and truck. The following table provides an example of these parameter values from Kansas Department of Transportation Benefit-Cost Analysis.

Table 1. Emission Factors and Cost Rates, Kansas Department of Transportation Benefit-Cost Analysis (BCA)

Now let’s walk through the R codes for implementing the Shiny application that renders the following result:

Emission Costs of Rail vs. Truck

The layout of the lower part of this application is a tabsetPanel which includes four tabPanel . The first one is the Emission Costs tab.

ui <- fluidPage(# upper part of the application
# lower part of the application
tabsetPanel(
tabPanel("Emission Costs",
# Emission costs interface
),
tabPanel("Accident Costs",
# Accident costs interface
),
tabPanel("Pavement Damage Cost",
# Pavement damage cost interface
),
tabPanel("Efficiency Benefits",
# Efficiency benefits interface
)
)
)

As discussed above, to use this cost calculation tool for any specific project, it is necessary to adjust the input parameter values for the specific project under evaluation.

In ui() we specify the input and output components of the application. There is a panel area on the left where numericInput components are used to take customized values as inputs. These inputs are arranged into two groups, i.e, Emission Rates (grams/ton-mile) and Emission Costs ($/ton).

At the bottom of the input panel, there is a actionButton() for resetting the values of all the numericInput components to their default values.

When users change input parameter values, the table "emission_info"and the chart "emission_chart"on the right will be updated accordingly.

In the server() we process the data and render the tables and charts. get_emission() function returns the emission costs for selected origin-destination zone pair, and this is where all the calculations take place.

Within the get_emission() function, selected_od() returns a non-null value once the origin and destination zone pair is selected by clicking on the map. The get_total() function returns the freight volume information for the selected origin-destination, including ton, ton-mile and the average (shipping) distance for each mode. Please prefer to my previous article for the details of get_total() function.

Freight volume for the selected origin-destination zone pair

In get_emission() function, we transform freight volumes into emission costs using the formula introduced above. Note that the emission amount originally specified as grams is converted to tons by dividing 907185 .

emission_info() renders the table output based on the emission costs returned from get_emission() .

emission_chart() renders the bar chart output for the emission costs returned from get_emission().

observeEvent(input$resetEmission, {}) resets all the numericInput components associated with emission costs to their default values when the actionButton is clicked.

Background Information on Government Regulations for Emissions

In the table 1 of emission factors and cost rates, you would find terms like MOVES and SAFE in the data source column. For your reference, a brief background information on these terms are provided as follows.

The U.S. Department of Transportation’s National Highway Traffic Safety Administration (NHTSA) is required by Federal law to set fuel economy standards at the maximum feasible level for both motor vehicles, for every model year, which means it sets the next generation of fuel economy standards for our Nation’s new vehicles. (REF)

Safer Affordable Fuel-Efficient (SAFE) Vehicles Rule issued by NHTSA and EPA establishes carbon dioxide and fuel economy standards. It sets Corporate Average Fuel Economy (CAFE) and CO2 emissions standards for motor vehicles. The agencies issues SAFE Vehicles Rule based on both CAFE model and MOVES model.

NHTSA’s CAFE model was used to project a pathway the industry could use to comply with each regulatory alternative, along with resultant impacts on per-vehicle costs. In determining what levels of CAFE standards would be maximum feasible, the law directs NHTSA to consider four specific factors: technological feasibility; economic practicability; the effect of other motor vehicle standards of the Government on fuel economy; and the Nation’s need to conserve energy. (REF)

EPA’s MOVES model as introduced in the previous session, was used to calculate corresponding changes in total fuel consumption and annual emissions.

Accident Costs

There are a wide variety of costs associated with accidents, such as medical costs, property damage cost, lost productivity cost, insurance administration cost, emergency services cost, and the non monetary costs of lost quality of life and pain and suffering as a result of death and serious injury.

Accidents can be categorized into two types, i.e., fatality accidents and injury accidents. The cost structure of these two types of accidents are very different.

Accident Costs = (Fatality Costs) + (Injury Costs)

When determine the fatality or injury rate for truck mode, trip-specific considerations such as traffic volume on the roadway, design of the roadway itself, weather conditions, and factors peculiar to the truck and driver all enter the picture.

There are a variety of reasons why train accidents occur, and most of which take place at crossings when cars try to “beat” the train. While every case is unique, the most common causes of train accidents include negligence, human error, mechanical failure, speedy trains, defective tracks and suicides, etc. (REF) Therefore, different rail operating scenarios would have very different accident event rate.

The number of fatalities and personal injuries associated with 100 million miles of truck operations is available from NHTSA (REF), from which the average accident event rate per vehicle-mile can be derived accordingly. Then the average accident event rate per ton-mile can be calculated by applying the average load factors (tons/vehicle).

Number of Accidents = (Accident Event Rate) × (Travel Quantity)

How do we place a value on saving human lives and preventing personal injuries? The general approach is to estimate the “willingness to pay.” According to this concept, the cost of a particular type of accident is the amount people would pay to reduce the risk of it happening.

It is important to recognize that the valuation of economic costs of accidents, is by nature normative and imprecise.

Accident Costs = (Accident Event Cost) × (Number of Accidents)

The input parameters to the accident cost model include event rate and event cost.The following table provides an example of these parameter values from Kansas Department of Transportation Benefit-Cost Analysis.

Table 2. Accident Event Rate and Event Cost, Kansas Department of Transportation Benefit-Cost Analysis (BCA)

The application makes it easy for users to change the variable values of event rates and event costs, and see the corresponding results instantaneously.

Accident Costs of Rail vs. Truck

Pavement Damage Costs

Whenever a truck travels on a public facility, some level of pavement damage cost arises from wear and tear on the roadway. The value of this cost depend both on the type of vehicle making the trip and on characteristics of the roadway on which the vehicle is operating.

The pavement damage cost is calculated based on the cost rate ($/Mile) and the Vehicle Miles Traveled (VMT).

Pavement Damage Costs = VMT × $/Mile

VMT = Trucks × (Miles Traveled)

Trucks = (Shipping Weight) / (Truck Payload)

The number of truck shipments can be calculated from the shipping volume (tons) divided by truck payload. A truck’s payload refers to the maximum amount of weight that can safely be loaded to a truck in addition to its empty weight (or curb weight).

In the Benefit-Cost Analysis Tool from Kansas Department of Transportation, truck payload is not directly provided. Instead, truck payload is calculated using the rail payload (tons/carload) and carload to truck conversion rate (trucks/carload).

Trucks = Weight / (Rail Payload) × (Truck Conversion Rate)

Table 3. Pavement Damage Rate, Kansas Department of Transportation Benefit-Cost Analysis (BCA)

Transportation Costs

As the transportation costs of shipping the same ton-miles is lower using rail than truck, sometimes this cost saving is referred as the transportation efficiency benefit of using rail vs. truck.

Within the rail freight sector there appear to be economies of scale, and the costs of different types of service could vary substantially among different types of rail operations. As freight rail operations vary widely, a single aggregate value for cost per ton-mile would hold little meaning.

To provide representative estimates of transportation costs under different operations scenarios, it is essential to update the cost per ton-mile value for the specific operations scenario.

Transportation Cost = ($/ton-mile) × (ton-miles)

Table 4. Transportation Cost Rate, Kansas Department of Transportation Benefit-Cost Analysis (BCA)

R codes and input data are available at my GitHub repo.

Geek Culture

Proud to geek out. Follow to join our +500K monthly readers.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store