FORECASTING USING R
Welcome to Forecasting Using R
Rob Hyndman
Author, forecast
Welcome to Forecasting Using R Rob Hyndman Author, forecast - - PowerPoint PPT Presentation
FORECASTING USING R Welcome to Forecasting Using R Rob Hyndman Author, forecast Forecasting Using R What you will learn Exploring and visualizing time series Simple benchmark methods for forecasting Exponential smoothing and
FORECASTING USING R
Author, forecast
Forecasting Using R
Forecasting Using R
Forecasting Using R
Forecasting is estimating how the sequence of observations will continue into the future.
Forecasting Using R
seasonality and other features of the data?
FORECASTING USING R
FORECASTING USING R
Forecasting Using R
Paern Description Trend A paern exists involving a long-term increase OR decrease in the data Seasonal A periodic paern exists due to the calendar (e.g. the quarter, month, or day of the week) Cyclic A paern exists where the data exhibits rises and falls that are not of fixed period (duration usually of at least 2 years)
Forecasting Using R
Forecasting Using R
Forecasting Using R
Forecasting Using R
Forecasting Using R
Differences between seasonal and cyclic paerns:
length
paern The timing of peaks and troughs is predictable with seasonal data, but unpredictable in the long term with cyclic data.
FORECASTING USING R
FORECASTING USING R
Forecasting Using R
> set.seed(3) # Reproducibility > wn <- ts(rnorm(36)) # White noise > autoplot(wn) # Plot!
"White noise" is just a time series of iid data
Forecasting Using R
> ggAcf(wn) + ggtitle("Sample ACF for white noise")
Expectation: each autocorrelation is close to zero 95% of all autocorrelations for white noise should lie within the blue lines If not: series is probably not white noise
Forecasting Using R
> autoplot(pigs/1000) + > xlab("Year") + > ylab("thousands") + > ggtitle("Monthly number of pigs slaughtered in Victoria")
Forecasting Using R
> ggAcf(pigs) + > ggtitle("ACF of monthly pigs slaughtered in Victoria")
significant autocorrelation at lags 1, 2, and 3 Not a white noise series: there is info in the data that can be used to forecast future values
Forecasting Using R
> Box.test(pigs, lag = 24, fitdf = 0, type = "Lj") Box-Ljung test data: pigs X-squared = 634.15, df = 24, p-value < 2.2e-16
The Ljung-Box test considers the first h autocorrelation values
A significant test (small p-value) indicates the data are probably not white noise.
Forecasting Using R
FORECASTING USING R