100%(1)1 out of 1 people found this document helpful
This preview shows page 1 - 5 out of 34 pages.
GREATLAKES INSTITUTE OF MANAGEMENT, GURGOAN. “TIME SERIES FORECASTING” ======================================================== Author: YURNGAM ANGKANG. date: 1st November, 2019. autosize: trueNB: dataset ‘gas’(Australian monthly gas production) in R’Package, “forecast”Project highlights Explore the “gas”(Australian monthly gas production) dataset in Forecast package to do the following:Read the data as a time series object in R. Plot the data (5 marks) What do you observe? Which components of the time series are present in this dataset? (5 marks) What is the periodicity of dataset? (5 marks) Is the time series Stationary? Inspect visually as well as conduct an ADF test? Write down the null and alternate hypothesis for the stationarity test? De-seasonalise the series if seasonality is present? (20 marks) Develop an ARIMA Model to forecast for next 12 periods. Use both manual and auto.arima (Show & explain all the steps) (20 marks) Report the accuracy of the model (5 marks) ======================================================== Slides With Code’(encoding:UTC-8)’ ======================================================== NB:In this Time Series Forecasting Project, I will be exploring the dataset ‘gas’ with different types of packages and methods. Since, there are similarities in the steps or types of explorations and methods, it may seems like continuetion or repeatation of an exact procedure and methods. However, in order to understand the problem statement and solving methods thoroughly with every mimic details being applied on the process. ======================================================= #As the First step, an exploration and understanding of the data needed to be done. In order to Understand the data visually, and for this purpose, the data is converted to time series object using ts(), and plotted visually using plot() functions available in R. It will be followed by Forecast Packages and Methods.#Before going into more accurate Forecasting functions for Time series, let us do some basic forecasts using Meanf(), naïve(), random walk with drift - rwf() methods. Though these may not give us proper results but we can use the results as bench marks. #All these forecasting models returns objects which contain original series, point forecasts, forecasting methods used residuals. Below functions shows three methods & their plots.library(quantmod)library(tseries)1
library(timeSeries)library(forecast)library(xts)data(gas)We can work with the gas dataset from the forecast library. This is a time series measuring the monthly gas production in Australia between 1956 and 1995. The auto.arima function will create an ARIMA model using our dataset and display the output.plot(gas)2
plot of chunk unnamed-chunk-5MyMod <-auto.arima(gas)MyModSeries: gas ARIMA(2,1,1)(0,1,1) Coefficients:ar1 ar2 ma1 sma10.3756 0.1457 -0.8620 -0.6216s.e. 0.0780 0.0621 0.0571 0.03763
sigma^2 estimated as 2587081: log likelihood=-4076.58AIC=8163.16 AICc=8163.29 BIC=8183.85We can see this time series model has a lot of seasonal variation. We will cover how to account for seasonality later on. Now that we have our model, we can use it to forecast future Australian gas production. We do this using the forecast function, and the arguments are the model we created and the number of periods for forecasting defined as “h” (this is how far we are forecasting). Let’s try predicting 12 months into the future.