# ARIMA Models

Write a 15 – 20 pages report on the application of all the forecasting methods covered in this
module on a data set. Provide references to all sources that you use.
The methods are covered in
·Topic 1: Regression
·Topic 2: Time series decomposition and Exponential Smoothing
·Topic 3: ARIMA models
The data set must be a single variable time series with at least 100 observations. It can be
primary or secondary data. Refer to the source from which it is obtained. In the report, include
the values of the variable and describe the variable used.
Use a computer package, such as R, with which you should be familiar by now, to apply the
forecasting methods on the data. Include the output as well as graphs and tables in the report.
Interpret the output of each forecasting method on the data and describe your conclusions
clearly.
Compare the suitability of the forecasting methods for the chosen data set and justify your
choice.
The report should consist of an introduction, a description of the chosen data, the application of
each of the forecasting methods on the data set, and the comparison of the results and your
conclusions. References should be shown in a proper reference list/bibliography.

Solution

1 Introduction

Time series data often arise when monitoring industrial processes or tracking
corporate business metrics. The essential difference between modeling data via
time series methods or using the process monitoring methods discussed earlier in
this chapter is the following:Time series analysis accounts for the fact that data
points taken over time may have an internal structure (such as autocorrelation,
trend or seasonal variation) that should be accounted for. This section will give
a brief overview of some of the more widely used techniques in the rich and
rapidly growing field of time series modeling and analysis.

2 DATA REPRESENTATION
Here, the forecasts of all future values are equal to the mean of the historical
data. If we let the historical data be denoted by y1, …. ,yT,y1, …. ,yT, then we
can write the forecasts as The notationyT+h|Tis a short-hand for the estimate of yT+hbasedonthedatay1,…., yTy1,…,yT :
Although we have used time series notation here, this method can also be
used for cross-sectional data (when we are predicting a value not included in the
data set). Then the prediction for values not observed is the average of those
values that have been observed. The remaining methods in this section are only
applicable to time series data.
2.1 Drift method
variation on the na¨ıve method is to allow the forecasts to increase or decrease
over time, where the amount of change over time (called the drift) is set to be
the average change seen in the historical data. So the forecast for time T+h is
given by This is equivalent to drawing a line between the first and last observation, and
extrapolating it into the future.
2.2 My data
In this data,that I have used is a univariate one,in which no missing values are
present,contains 255 values and it is a sequential .time series data.First of all
we will like to plot the data to find its graphical characteristics.

Subsection R code
beer2 !- window(ausbeer,start=1992,end=2006-.1)
beerfit1 !- meanf(beer2, h=11)
beerfit2 !- naive(beer2, h=11)
beerfit3 !- snaive(beer2, h=11)
plot(beerfit1, plot.conf=FALSE,
main=”Forecasts for quarterly beer production”)
lines(beerfit2mean,col=2)
lines(beerfit3mean,col=3)
legend(“topright”,lty=1,col=c(4,2,3),
legend=c(“Mean method”,”Naivemethod”,”Seasonal naive method”))
This is a typical example of r code ,to plot a time series data
The plot has been attached herewith .
Similarly ,other plots can be drawn to analyse the data the r codes necessary
to draw it is given as follows .The most important tw that I have used is time
plot and seasonal plot ,it is attached herewith .
plot(a10, ylab=”million; xlab= “Y ear; main = “nameofthedataset“)
plot(melsyd[,”name of data “], main=”Dataset name”, xlab=”Year”,ylab=”Thousands”)
The analysation that can be made from the data sets are as follows
In describing these time series, we have used words such as “trend” and “seasonal” which need to be more carefully defined.
A trend exists when there is a long-term increase or decrease in the data.
There is a trend in the observations data shown above.
A seasonal pattern occurs when a time series is affected by seasonal factors
such as the time of the year or the day of the week. The monthly sales ofobservation above shows seasonality partly induced by the change in costof the drugs at the end of the calendar year.

A cycle occurs when the data exhibit rises and falls that are not of a fixed
period. These fluctuations are usually due to economic conditions and are
often related to the “business cycle”. The economy class passenger data
above showed some indications of cyclic effects.
It is important to distinguish cyclic patterns and seasonal patterns. Seasonal
patterns have a fixed and known length, while cyclic patterns have variable
and unknown length. The average length of a cycle is usually longer than that
of seasonality, and the magnitude of cyclic variation is usually more variable
than that of seasonal variation.

Many time series include trend, cycles and seasonality. When choosing a
forecasting method, we will first need to identify the time series patterns in the
data, and then choose a method that is able to capture the patterns properly.
2.3 Regression
the forecast and predictor variables are assumed to be relatedby the simple linear model: In this epsilons are the errors introduced due to human precision and is assumed
to be distributed identically and independently with mean o and some unkonwn
variance,which we will predict from data from the knowledge of simple unbiased
estimator of variance. The parameters 00 and 11 determine the intercept and the
slope of the line respectively. The intercept 00 represents the predicted value of
yy when x=0x=0. The slope 11 represents the predicted increase in YY resulting
from a one unit increase in x. In this the case the value of the parametres are
given as follow
α = 865:85; β = 700
Hence the conclusion made from these are as follows
the observation has positive trend to follow with time ,from the regression
plot and calculation we can easily find out that notice that the observations do not lie on the straight line but are scatteredaround it. We can think of each observation yiconsisting of the systematicor explained part of the model, 0+1xi0+1xi, and the random “error”, ii. The
“error” term does not imply a mistake, but a deviation from the underlying
straight line model. It captures anything that may affect yiother than xi. We
assume that these errors:
have mean zero; otherwise the forecasts will be systematically biased. are
not autocorrelated; otherwise the forecasts will be inefficient as there is more
information to be exploited in the data. are unrelated to the predictor variable; otherwise there would be more information that should be included in
the systematic part of the model. It is also useful to have the errors normally
distributed with constant variance in order to produce prediction intervals and
to perform statistical inference. While these additional conditions make the
calculations simpler, they are not necessary for forecasting.
Another important assumption in the simple linear model is that x is not a
random variable. If we were performing a controlled experiment in a laboratory,
we could control the values of x (so they would not be random) and observe the
resulting values of y. With observational data it is not possible to control the value of x, and hence we makethis an assumption.
In practice, of course, we have a collection of observations but we do not know
the values of 00 and 11. These need to be estimated from the data. We call this
“fitting a line through the data”.
There are many possible choices for β0 and β1, each choice giving a different
line. The least squares principle provides a way of choosing β0 and β1 effectively
by minimizing the sum of the squared errors. That is, we choose the values that
minimize The forecast values of yy obtained from the observed xx values are called
“fitted values”. We write these as yi= β0 + β1xi, for i=1,. . . ,Ni=1,. . . ,N. Each
yiis the point on the regression line corresponding to observation xi.
The difference between the observed yvalues and the corresponding fitted
values are the “residuals”: The residuals have some useful properties including the following two: As a result of these properties, it is clear that the average of the residuals
is zero, and that the correlation between the residuals and the observations for
the predictor variable is also 0
the forecast using the regression model described abobe use the simple model
described above ,it predicts x from the observed that ,using the regression model
gives the fitted values which are then used
3 Decomposition
while decomposition is primarily useful for studying time series data, and exploring the historical changes over time, it can also be used in forecasting.
Assuming an additive decomposition, the decomposed time series can be
written as: or the multiplication model To forecast a decomposed time series, we separately forecast the seasonal component, St, and the seasonally adjusted componentAt. It is usually assumed
that the seasonal component is unchanging, or changing extremely slowly, and
so it is forecast by simply taking the last year of the estimated component. In
other words, a seasonal na¨ıve method is used for the seasonal component.
To forecast the seasonally adjusted component, any non-seasonal forecasting
method may be used. For example, a random walk with drift model, or Holt’s
method, or a non-seasonal ARIMA model, may be used.
We propose to use the additive model from theplots,as suggested from the plot curved from us.
R code cast !- forecast(fit, method=”naive”)
plot(fcast, ylab=”New orders index”)
4 Exponential smoothing
A variation from Holt’s linear trend method is achieved by allowing the level
and the slope to be multiplied rather than added: where btnow represents an estimated growth rate (in relative terms rather than
absolute) which is multiplied rather than added to the estimated level. The
trend in the forecast function is now exponential rather than linear, so that the
forecasts project a constant growth rate rather than a constant slope. The error correction form.We have used corrected exponential smoothing for my data set.
5 ARIMA MODELLING
Although we have calculated forecasts from the ARIMA models in our examples, we have not yet explained how they are obtained. Point forecasts can becalculated using the following three steps.
Expand the ARIMA equation so that ytis on the left hand side and all
other terms are on the right.
Rewrite the equation by replacing t by T+h. On the right hand side of
the equation, replace future
observations by their forecasts, future errors by zero, and past errors by
the corresponding residuals.
The calculation of ARIMA forecast intervals is much more difficult, and the
details are largely beyond the scope of this book. We will just give some simple
examples.
The first forecast interval is easily calculated. If is the standard deviation of
the residuals, then a 95 percentforecast interval is given by yT+1jT 1:96σ2yT +1jT 1:96σ
This result is true for all ARIMA models regardless of their parameters and orders.

6 conclusion
From the all the plots attached and by predicting the model with the help of
regression technique and then undergoing exponential smoothing,with the help
of proper r codes, we can easily forecast the future observation which coincides
with the observed values.  TimePlot