Discussion 2

Author

Aryamani Boruah

1 Part I

1.0.1 What is fpp3 package about? How many data sets does it have? What all packages does it load?

The fpp3 package is a meta-package designed for tidy time series analysis and forecasting in R.It provides datasets and tools for visualization, decomposition, and forecasting using tidy data principles.
The package contains approximately 80 built-in datasets, including commonly used datasets such as tourism, aus_airpassengers, and global_economy.

When loaded, fpp3 automatically attaches several packages, including tsibble, feasts, fable, and fabletools, along with tidyverse dependencies.
#install.packages(fpp3) # required only once
library(fpp3)
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     4.0.1     
Warning: package 'ggplot2' 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()
?fpp3

1.0.2 What is a tsibble

A tsibble is a tidy data structure for time series data. Unlike base R ts objects, tsibbles explicitly define a time index and optional key variables, allowing multiple time series to be stored and analyzed together.

This structure ensures temporal ordering and integrates seamlessly with tidy workflows.

?tsibble

1.0.3 What is feasts package about?

The feasts package focuses on exploratory time series analysis. It provides tools for understanding trends, seasonality, and autocorrelation before building forecasting models.

Key functionality includes decomposition methods, feature extraction, and seasonal diagnostics.

?'feasts-package'

1.0.4 What is fable package about?

The fable package is used for building and evaluating forecasting models on tidy time series data. It supports commonly used statistical forecasting methods and produces forecasts in a tidy and interpretable format.It integrates directly with tsibble objects and supports model comparison.

?fable
Help on topic 'fable' was found in the following packages:

  Package               Library
  fabletools            /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
  fable                 /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library


Using the first match ...

2 Part-II

library(fredr)
library(tidyverse)
Warning: package 'readr' was built under R version 4.5.2
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ forcats 1.0.1     ✔ readr   2.1.6
✔ purrr   1.2.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
library(tsibble)
library(feasts)
fredr_set_key("f95eac3f44d6965f475a2026b5216b1b")

I selected the CBOE Gold Volatility Index (GVZCLS). This index measures the expected 30-day volatility of gold prices, providing insights into market uncertainty and risk perceptions in precious metals markets (Wang, Cook, and Hyndman 2020). Higher values indicate greater expected volatility and market uncertainty.

# Fetching Gold Volatility Index data
gold_vol <- fredr(
  series_id = "GVZCLS",
  observation_start = as.Date("2008-01-01")
)

# Converting to tsibble - AGGREGATE to monthly
gold_vol_ts <- gold_vol |>
  mutate(month = yearmonth(date)) |>
  group_by(month) |>
  summarise(value = mean(value, na.rm = TRUE)) |>  # Take monthly average
  ungroup() |>
  as_tsibble(index = month)

# Display first few observations
head(gold_vol_ts)
# A tsibble: 6 x 2 [1M]
     month value
     <mth> <dbl>
1 2008 Jun  25.1
2 2008 Jul  27.1
3 2008 Aug  28.5
4 2008 Sep  40.6
5 2008 Oct  55.1
6 2008 Nov  48.4

2.1 Visualization 1: Time Plot

gold_vol_ts |>
  autoplot(value) +
  labs(
    title = "CBOE Gold Volatility Index (2008-2024)",
    x = "Time",
    y = "Volatility Index"
  ) +
  theme_minimal()

The time series reveals several periods of elevated gold volatility, particularly during the 2008-2009 financial crisis and the 2020 COVID-19 pandemic. These spikes reflect heightened uncertainty when investors flock to gold as a safe haven asset. The index shows mean-reverting behavior, with volatility typically declining after crisis periods.

2.2 Visualization 2: Seasonal Plot

gold_vol_ts |>
  gg_season(value, labels = "both") +
  labs(
    title = "Seasonal Pattern of Gold Volatility Index",
    x = "Month",
    y = "Volatility Index"
  ) +
  theme_minimal()
Warning: `gg_season()` was deprecated in feasts 0.4.2.
ℹ Please use `ggtime::gg_season()` instead.

The seasonal plot shows interesting patterns across different years. Crisis years (2008-2009 in red/orange, 2020 in pink) exhibit substantially higher volatility levels throughout the year. Non-crisis years tend to cluster at lower volatility levels, suggesting that seasonal effects are dominated by macroeconomic events and financial market stress.

2.3 Visualization 3: Subseries Plot

gold_vol_ts |>
  gg_subseries(value) +
  labs(
    title = "Gold Volatility Index by Month",
    x = "Year",
    y = "Volatility Index"
  ) +
  theme_minimal()
Warning: `gg_subseries()` was deprecated in feasts 0.4.2.
ℹ Please use `ggtime::gg_subseries()` instead.

The subseries plot provides a month-by-month view with horizontal blue lines indicating monthly averages. There appears to be modest seasonal variation, with certain months like March and September showing slightly higher average volatility. However, the large spikes during crisis periods dominate the monthly patterns, indicating that gold volatility is primarily driven by macroeconomic shocks rather than calendar effects (Hyndman 2025).

2.4 Visualization 4: ACF Plot

gold_vol_ts |>
  ACF(value, lag_max = 48) |>
  autoplot() +
  labs(
    title = "Autocorrelation Function of Gold Volatility Index",
    x = "Lag (months)",
    y = "ACF"
  ) +
  theme_minimal()

The autocorrelation function shows moderate positive autocorrelation at shorter lags, gradually declining toward zero. This indicates that current gold volatility has some persistence - high volatility today suggests elevated volatility in the near future. However, the relatively quick decay suggests gold volatility is less persistent than many economic indicators, consistent with financial market volatility that tends to cluster but eventually mean-revert. The pattern suggests gold volatility shocks are temporary rather than permanent.

3 Summary

Analysis of the CBOE Gold Volatility Index from 2008-2024 reveals that gold market volatility is primarily driven by major economic and financial crises rather than seasonal patterns. The index exhibits mean-reverting behavior with moderate short-term persistence, reflecting gold’s role as a safe haven asset during periods of market stress. Understanding these volatility dynamics is crucial for portfolio risk management and derivatives pricing in precious metals markets.

4 References

Hyndman, Rob. 2025. Fpp3: Data for "Forecasting: Principles and Practice" (3rd Edition). https://doi.org/10.32614/CRAN.package.fpp3.
Wang, Earo, Dianne Cook, and Rob J Hyndman. 2020. “A New Tidy Data Structure to Support Exploration and Modeling of Temporal Data.” Journal of Computational and Graphical Statistics 29: 466–78. https://doi.org/10.1080/10618600.2019.1695624.