Alaska Airlines

Author

Penelope Pooler Eisenbies

Published

May 2, 2024

Import and Examine Data

Show the code
# data source: https://www.transtats.bts.gov/Data_Elements.aspx?Data=1

alaska <- read_csv("data/alaska_passengers_5_2_2024.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)
Rows: 256
Columns: 2
$ Date  <date> 2002-10-31, 2002-11-30, 2002-12-31, 2003-01…
$ Total <dbl> 1.05, 1.06, 1.26, 1.05, 1.02, 1.19, 1.16, 1.…
Show the code
alaska_pp <- alaska |>          # post_pandemic data 
  filter(Date >= "2021-06-01") |>
  glimpse(width=60)
Rows: 32
Columns: 2
$ Date  <date> 2021-06-30, 2021-07-31, 2021-08-31, 2021-09…
$ Total <dbl> 2.39, 2.55, 2.43, 2.05, 2.26, 2.29, 2.32, 1.…

Interactive Time Series Plot

Full and Truncated Data Plots

Plot of Full Time Series

Seasonal pattern was disrupted by the pandemic when air travel was considered dangerous.

Plot of Truncated Time Series

Once 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.

Forecast Modeling

Create Time Series (ts)

Show the code
alaska_ts <- ts(alaska_pp$Total, freq=12, start=c(2021,6)) # create time series

alaska_ts # display time series
      Jan  Feb  Mar  Apr  May  Jun  Jul  Aug  Sep  Oct  Nov  Dec
2021                          2.39 2.55 2.43 2.05 2.26 2.29 2.32
2022 1.81 2.02 2.70 2.71 2.78 2.79 3.01 2.94 2.69 2.80 2.67 2.73
2023 2.53 2.38 2.89 2.90 3.05 3.24 3.47 3.30 2.87 2.88 2.80 2.86
2024 2.18                                                       

Model 1

Show the code
alaska_model1 <- alaska_ts |> auto.arima(ic="aic", seasonal=F)

alaska_forecast1 <- alaska_model1 |> forecast(h=12)

(alaska_fcp1 <- autoplot(alaska_forecast1) + 
    labs(y = "Number of Passenger (Mill.)") + 
    theme_classic())

Show the code
alaska_forecast1
         Point Forecast     Lo 80    Hi 80     Lo 95    Hi 95
Feb 2024           2.18 1.8331395 2.526860 1.6495227 2.710477
Mar 2024           2.18 1.6894652 2.670535 1.4297918 2.930208
Apr 2024           2.18 1.5792201 2.780780 1.2611864 3.098814
May 2024           2.18 1.4862791 2.873721 1.1190454 3.240955
Jun 2024           2.18 1.4043964 2.955604 0.9938167 3.366183
Jul 2024           2.18 1.3303689 3.029631 0.8806013 3.479399
Aug 2024           2.18 1.2622935 3.097707 0.7764890 3.583511
Sep 2024           2.18 1.1989305 3.161070 0.6795836 3.680416
Oct 2024           2.18 1.1394186 3.220581 0.5885681 3.771432
Nov 2024           2.18 1.0831309 3.276869 0.5024835 3.857516
Dec 2024           2.18 1.0295940 3.330406 0.4206059 3.939394
Jan 2025           2.18 0.9784401 3.381560 0.3423728 4.017627
Show the code
checkresiduals(alaska_forecast1, test=F)

Show the code
(acr1 <- accuracy(alaska_forecast1)) 
                       ME      RMSE       MAE        MPE     MAPE      MASE
Training set -0.006487813 0.2663941 0.1916372 -0.8814875 7.655185 0.5315872
                    ACF1
Training set -0.02463493

Model 2

Show the code
alaska_model2 <- alaska_ts |> auto.arima(ic="aic", seasonal=T) 

alaska_forecast2 <- alaska_model2 |> forecast(h=12)

(alaska_fcp2 <- autoplot(alaska_forecast2) + 
    labs(y = "Number of Passenger (Mill.)") + 
    theme_classic())

Show the code
alaska_forecast2
         Point Forecast    Lo 80    Hi 80     Lo 95    Hi 95
Feb 2024           2.03 1.795097 2.264903 1.6707465 2.389254
Mar 2024           2.54 2.207797 2.872203 2.0319388 3.048061
Apr 2024           2.55 2.143136 2.956864 1.9277546 3.172245
May 2024           2.70 2.230193 3.169807 1.9814929 3.418507
Jun 2024           2.89 2.364740 3.415260 2.0866847 3.693315
Jul 2024           3.12 2.544607 3.695393 2.2400122 3.999988
Aug 2024           2.95 2.328504 3.571496 1.9995045 3.900496
Sep 2024           2.52 1.855593 3.184407 1.5038776 3.536122
Oct 2024           2.53 1.825290 3.234710 1.4522394 3.607761
Nov 2024           2.45 1.707171 3.192829 1.3139406 3.586059
Dec 2024           2.51 1.730914 3.289086 1.3184908 3.701509
Jan 2025           1.83 1.016271 2.643729 0.5855092 3.074491
Show the code
checkresiduals(alaska_forecast2, test=F)

Show the code
(acr2 <- accuracy(alaska_forecast2)) 
                      ME     RMSE        MAE       MPE     MAPE     MASE
Training set -0.02356205 0.141239 0.08006416 -1.042747 3.061075 0.222092
                    ACF1
Training set 0.008621451