title: “Discussion” author: “AS” format: html editor: visual toc: true number-sections: true code-link: true echo: true warning: false fig-crop: false —

To Do

Question 1

What is a ‘fpp3’

“fpp3” is a R package created by Rob J. Hyndman which loads multiple libraries that are helpful for data analysis. The fpp3 library loads nine different packages, such as ggplot2 for plotting, or fable which is used for forecasting models. We see that it loads: tibble, dplyr, tidyr, lubridate, ggplot2, tsibble, tsibble

library(fpp3)
## Warning: package 'fpp3' was built under R version 4.5.2
## Registered S3 method overwritten by 'tsibble':
##   method               from 
##   as_tibble.grouped_df dplyr
## ── Attaching packages ──────────────────────────────────────────── fpp3 1.0.2 ──
## ✔ tibble      3.3.0     ✔ tsibble     1.1.6
## ✔ dplyr       1.1.4     ✔ tsibbledata 0.4.1
## ✔ tidyr       1.3.1     ✔ feasts      0.4.2
## ✔ lubridate   1.9.4     ✔ fable       0.5.0
## ✔ ggplot2     3.5.2
## Warning: package 'tsibble' was built under R version 4.5.2
## Warning: package 'tsibbledata' was built under R version 4.5.2
## Warning: package 'feasts' was built under R version 4.5.2
## Warning: package 'fabletools' was built under R version 4.5.2
## Warning: package 'fable' was built under R version 4.5.2
## ── Conflicts ───────────────────────────────────────────────── fpp3_conflicts ──
## ✖ lubridate::date()    masks base::date()
## ✖ dplyr::filter()      masks stats::filter()
## ✖ tsibble::intersect() masks base::intersect()
## ✖ tsibble::interval()  masks lubridate::interval()
## ✖ dplyr::lag()         masks stats::lag()
## ✖ tsibble::setdiff()   masks base::setdiff()
## ✖ tsibble::union()     masks base::union()

What is a tsibble

Tsibble is one of the libraries included in fpp3 and it is a special type of data frame which is designed specifically for time series data. It requires the user to specify a time column called “index” and it makes sure that the data used has a proper time structure. It is pretty good at understanding time intervals (daily, monthly, quarterly, yearly, etc).

What is feasts package about?

The feast package provides tools for visualizing time series patterns with the help of specialized plots, such as seasonal plots, subseries plots, etc. It is used before forecasting models to help understanding patterns in the data, so it is more a exploratory analysis tool. This is important because it helps to analyze the data before applying a model to predict the future

What is fable package about?

The fable package is used after you explore the data because it helps to build and apply the forecasting models to time series data. It includes common forecasting methods. One of the methods is the automatic Arima model

Question 2

# --- SETUP ---

library(fredr)
## Warning: package 'fredr' was built under R version 4.5.2
library(fpp3)
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.5.2
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ forcats 1.0.0     ✔ readr   2.1.5
## ✔ purrr   1.1.0     ✔ stringr 1.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter()     masks stats::filter()
## ✖ tsibble::interval() masks lubridate::interval()
## ✖ dplyr::lag()        masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
fredr_set_key("25a2f276fc2718f836f19918a0e31d4a")

# Download unemployment rate data
unemployment_ts <- fredr(
  series_id = "UNRATE",
  observation_start = as.Date("2010-01-01")
) %>%
  mutate(Month = yearmonth(date)) %>%
  as_tsibble(index = Month) %>%
  select(Month, value)

unemployment_ts
## # A tsibble: 192 x 2 [1M]
##        Month value
##        <mth> <dbl>
##  1  2010 1月   9.8
##  2  2010 2月   9.8
##  3  2010 3月   9.9
##  4  2010 4月   9.9
##  5  2010 5月   9.6
##  6  2010 6月   9.4
##  7  2010 7月   9.4
##  8  2010 8月   9.5
##  9  2010 9月   9.5
## 10 2010 10月   9.4
## # ℹ 182 more rows

Plots

# 1. Time Plot
unemployment_ts %>%
  autoplot(value) +
  labs(
    title = "U.S. Civilian Unemployment Rate",
    subtitle = "2010 - Present",
    y = "Percent (%)",
    x = "Month"
  )

# 2. Seasonal Plot
unemployment_ts %>%
  gg_season(value, labels = "both") +
  labs(title = "Seasonal Plot: Unemployment")
## Warning: `gg_season()` was deprecated in feasts 0.4.2.
## ℹ Please use `ggtime::gg_season()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

# 3. Subseries Plot
unemployment_ts %>%
  gg_subseries(value) +
  labs(title = "Seasonal Subseries Plot")
## Warning: `gg_subseries()` was deprecated in feasts 0.4.2.
## ℹ Please use `ggtime::gg_subseries()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

# 4. Lag Plot
unemployment_ts %>%
  gg_lag(value, geom = "point") +
  labs(title = "Lag Plot")
## Warning: `gg_lag()` was deprecated in feasts 0.4.2.
## ℹ Please use `ggtime::gg_lag()` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Warning: Removed 1 rows containing missing values (gg_lag).

References

Hyndman, Rob. 2025. “Fpp3: Data for ”Forecasting: Principles and Practice” (3rd Edition).” https://doi.org/10.32614/CRAN.package.fpp3.

O’Hara-Wild, Mitchell, Rob Hyndman, and Earo Wang. 2024. “Fable: Forecasting Models for Tidy Time Series.” https://doi.org/10.32614/CRAN.package.fable.

———. 2025. “Feasts: Feature Extraction and Statistics for Time Series.” https://doi.org/10.32614/CRAN.package.feasts.

Wang, Earo, Dianne Cook, and Rob J Hyndman. 2020. “A New Tidy Data Structure to Support Exploration and Modeling of Temporal Data” 29: 466–78. https://doi.org/10.1080/10618600.2019.1695624.