fpp3 is a wrapper package designed to simplify the workflow for the book using tidy principles. Instead of loading packages individually, it acts as a ‘meta-package’ that attaches core tools like tsibble for data management and fable for modelling simultaneously.
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
A tsibble (Time Series Tibble) is a modern data frame explicitly designed to be time-aware. Unlike standard data frames in R, a tsibble enforces strict structural rules: 1. Index: A variable that represents time (e.g., Year, Month, Quarter). 2. Key: Optional variables that identify separate time series within the same dataset (e.g., strictly separating data by Region or Product). This structure prevents common errors by ensuring valid time gaps and ordering.
1.3 Q3: What is feasts package about?
feasts stands for Feature Extraction And Statistics for Time Series. It focuses on analyzing the underlying structure of the data before modeling. Key capabilities include: * Decomposition: Breaking data into trend, seasonality, and remainder (e.g., STL decomposition). * Graphics: producing autocorrelation plots (ACF), seasonal plots, and lag plots. * Features: Calculating summary statistics (like spectral entropy or trend strength) to describe series characteristics quantitatively.
1.4 Q4: What is fable package about?
fable is the forecasting engine of the ecosystem. It allows for a “tidy” workflow to fit and evaluate forecasting models. Its primary strength is batch forecasting: it can fit multiple models (such as ARIMA, ETS, or TSLM) across many different time series simultaneously using a unified syntax, and produces forecast distributions rather than just point forecasts.
2 Part II
For this analysis, I examined broad US Macroeconomic Indicators to understand national trends. I retrieved data from the Federal Reserve Economic Data (FRED) using the fredr package and converted them into tsibble objects for analysis using fpp3 functions.
gdp_ts %>%autoplot(value, color ="#2C3E50", size =1) +labs(title ="US Real Gross Domestic Product (GDPC1)",subtitle ="Quarterly Data (2000 - Present)",y ="Billions of Chained 2012 Dollars",x ="Year") +theme_minimal()
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
ℹ The deprecated feature was likely used in the fabletools package.
Please report the issue at <https://github.com/tidyverts/fabletools/issues>.
unrate_ts %>%autoplot(value, color ="#E74C3C", size =0.8) +labs(title ="US Unemployment Rate",subtitle ="Monthly Data showing clear cyclical spikes during recessions",y ="Percent",x ="Year") +theme_minimal()
cpi_ts %>%autoplot(value, color ="#27AE60", size =1) +labs(title ="Consumer Price Index for All Urban Consumers",subtitle ="Index 1982-1984=100",y ="Index Value",x ="Year") +theme_minimal()