Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
Feb 2025 11.92363 11.24113 12.60612 10.87984 12.96741
Mar 2025 14.42363 13.69401 15.15324 13.30778 15.53947
Apr 2025 14.19363 13.41976 14.96749 13.01010 15.37715
May 2025 15.42363 14.60790 16.23935 14.17608 16.67117
Jun 2025 15.83363 14.97809 16.68916 14.52520 17.14205
Jul 2025 15.11363 14.22005 16.00720 13.74702 16.48023
Aug 2025 15.58363 14.65357 16.51368 14.16122 17.00603
Sep 2025 14.05363 13.08846 15.01879 12.57753 15.52972
Oct 2025 14.65363 13.65459 15.65266 13.12573 16.18152
Nov 2025 13.22363 12.19183 14.25542 11.64562 14.80163
Dec 2025 14.13363 13.07007 15.19718 12.50706 15.76019
Jan 2026 12.14363 11.04924 13.23801 10.46991 13.81734
ME RMSE MAE MPE MAPE MASE
Training set -0.1163179 0.4397431 0.2979508 -0.9137009 2.266666 0.2367037
ACF1
Training set -0.04891274
Source Code
---title: "Delta Air Lines"author: "Penelope Pooler Eisenbies"date: last-modifiedlightbox: truetoc: truetoc-depth: 3toc-location: lefttoc-title: "Table of Contents"toc-expand: 1format: html: code-line-numbers: true code-fold: true code-tools: trueexecute: echo: fenced---```{r}#| label: setup#| include: false# suppress scientific notationoptions(scipen=100)# install helper package that loads and installs other packages, if neededif (!require("pacman")) install.packages("pacman", repos ="http://lib.stat.cmu.edu/R/CRAN/")# install and load required packages# pacman should be first package in parentheses and then list otherspacman::p_load(pacman,tidyverse, magrittr, knitr, gridExtra, forecast, tidyquant, lubridate, ggthemes, RColorBrewer, dygraphs, xts)# verify packages#p_loaded()```## Import and Examine Data```{r}#| label: import data# data source: https://www.transtats.bts.gov/Data_Elements.aspx?Data=1delta <-read_csv("data/delta_airlines_4_30_2025.csv",show_col_types = F, skip=1)|>filter(Month !="TOTAL") |>mutate(date_som =ym(paste(Year, Month)),Date =ceiling_date(date_som, "month")-1,Total = (TOTAL/1000000) |>round(2)) |>select(Date, Total) |>glimpse(width=60)delta_pp <- delta |># post_pandemic data filter(Date >="2021-06-01") |>glimpse(width=60)```### Interactive Time Series Plot```{r}#| label: create dygraph# create interactive plotdelta_xts <-xts(x=delta[,2], order.by=delta$Date)(delta_dg <-dygraph(delta_xts[,1], main="Delta Air Lines - Total Passengers") |>dySeries("Total", label="Total (Mill.)", color="blue") |>dyAxis("y", label ="", drawGrid =FALSE) |>dyAxis("x", label ="", drawGrid =FALSE) |>dyShading(from="2020-3-12", to="2021-6-14", color ="lightgrey") |>dyRangeSelector())```## Full and Truncated Data Plots### Plot of Full Time SeriesSeasonal pattern was disrupted by the pandemic when air travel was considered dangerous.```{r}#| label: Full Time Series#| warning: false#| message: false(full_plot <- delta |>ggplot() +geom_line(aes(x=Date, y=Total), linewidth=1, color="blue") +theme_classic() +scale_x_date(date_breaks ="2 years", date_labels ="%Y", limits=c(ymd("2001-12-31"), ymd("2025-01-31"))) +#scale_y_continuous(breaks=seq(0,5,.5), limits=c(0,5)) +labs(title="delta Airlines: October 2002 - January 2025",subtitle="Total Passengers (Domestic and International)",x="Date", y="Millions of Passengers",caption="Data Source: https://www.bts.gov/" ) +theme(plot.title =element_text(size =15),plot.caption =element_text(size =10),axis.title.x =element_text(size =15),axis.title.y =element_text(size =15),axis.text.x =element_text(size =10),axis.text.y =element_text(size =15)))ggsave("img/delta_full_plot_2025_04_30.png", width=6, height=4, unit="in")```### Plot of Truncated Time SeriesOnce vaccines became readily available, air travel began to resume it's traditional pattern:- Peaks occur at the end of July- Low points occur at the end of Jnauary- Pattern is not straightforward to discern because post-pandemic data are fairly limited.- Data for February and March of 2024 are not available yet.```{r}#| label: Truncated Time Series#| warning: false#| message: false(short_plot <- delta_pp |>ggplot() +geom_line(aes(x=Date, y=Total), linewidth=1, color="blue") +theme_classic() +scale_x_date(date_breaks ="2 months", date_labels ="%b", limits=c(ymd("2021-05-31"), ymd("2025-1-31")))+#scale_y_continuous(limits=c(2,5)) +labs(title="Delta Air Lines: June 2021 - January 2025",subtitle="Total Passengers (Domestic and International)",x="Date", y="Millions of Passengers",caption="Data Source: https://www.bts.gov/" ) +theme(plot.title =element_text(size =15),plot.caption =element_text(size =10),axis.title.x =element_text(size =15),axis.title.y =element_text(size =15),axis.text.x =element_text(size =10),axis.text.y =element_text(size =15)))#ggsave("img/delta_trnc_plot_2024_04_21.png", width=6, height=4, unit="in")```## Forecast Modeling### Create Time Series (`ts`)```{r}#| label: create time seriesdelta_ts <-ts(delta_pp$Total, freq=12, start=c(2021,6)) # create time seriesdelta_ts # display time series```### Model 1```{r}#| label: Model 1delta_model1 <- delta_ts |>auto.arima(ic="aic", seasonal=F)delta_forecast1 <- delta_model1 |>forecast(h=12)(delta_fcp1 <-autoplot(delta_forecast1) +labs(y ="Number of Passenger (Mill.)") +theme_classic())delta_forecast1checkresiduals(delta_forecast1, test=F)(acr1 <-accuracy(delta_forecast1)) ```### Model 2```{r}#| label: Model 2delta_model2 <- delta_ts |>auto.arima(ic="aic", seasonal=T) delta_forecast2 <- delta_model2 |>forecast(h=12)(delta_fcp2 <-autoplot(delta_forecast2) +labs(y ="Number of Passenger (Mill.)") +theme_classic())delta_forecast2checkresiduals(delta_forecast2, test=F)(acr2 <-accuracy(delta_forecast2)) ```