Chapter 5 Box-Jenkins method
In this chapter, you will practice selecting and fitting an ARIMA model to catch data using the Box-Jenkins method. After fitting a model, you will prepare simple forecasts using the forecast package.
A script with all the R code in the chapter can be downloaded here. The Rmd for this chapter can be downloaded here
Data and packages
We will use the catch landings from Greek waters (greeklandings
) and the Chinook landings (chinook
) in Washington data sets for this chapter. These datasets are in the atsalibrary package on GitHub. Install using the devtools package.
library(devtools)
# Windows users will likely need to set this
# Sys.setenv('R_REMOTES_NO_ERRORS_FROM_WARNINGS' = 'true')
::install_github("nwfsc-timeseries/atsalibrary") devtools
Load the data.
data(greeklandings, package = "atsalibrary")
<- greeklandings
landings # Use the monthly data
data(chinook, package = "atsalibrary")
<- chinook.month chinook
Ensure you have the necessary packages.
library(ggplot2)
library(gridExtra)
library(reshape2)
library(tseries)
library(urca)
library(forecast)