Home

Awesome

Route Trends: Upload, Analyze, Forecast Ridership by Route

Authors

Creator: Joel Huting
Authors: Joey Reid, Kim Eng Ky, Eric Lind
Sponsoring Institution: Metro Transit, Minneapolis-St. Paul, MN USA

Purpose

R Shiny app to ingest ridership time series, and return:

The main purpose of this app is to facilitate use of the timeseries methodology by transit agencies interested in better understanding their ridership data. The descriptions and examples are thus focused on counts of riders, by route, on a monthly basis, matching required submissions to the National Transit Database where many such timeseries can be found.

Output

This code is provided to allow for collaborative improvement and modification of the app, and to enable local implementation. To simply use the route trends app, you can go to the Metro Transit shinyapps.io page.

Methods

R, R Studio, and Shiny

This repository contains code to be run in RStudio, the IDE built for the statistical language R. The code includes R packages developed by others (see list of packages at the end of this README), including Shiny, a package to build interactive web apps in html and java, from within the R environment.

Data format

The app requires a datafile in CSV with the following columns, in this order:

Analysis methods

Trends are calculated using "Seasonal-Trend Decomposition Procedure Based on Loess (STL)" STL Decomposition is a filtering procedure for decomposing a seasonal time series into three compenents:

Approaches for extracting STL components:

In this app, we include six different forecasting methods. Each method has its strengths and may fit better to a given timeseries. Note the timeseries length requirements can differ among approaches, but all generally require at least two years or 25 months of data to be estimated.

Deciding on best-fit models for your timeseries

The simplest determinant of the accuracy of forecasting models is in-sample mean absolute percentage error (MAPE).MAPE is the average (mean) percentage difference between actual and predicted values. Small MAPE is preferable, and can be compared across different models forecasting the same time series.

R Packages Used