2. ANTECEDENTES
2.2. SULFURO DE HIDRÓGENO
The steps involved in the Box-Jenkins (ARIMA) approach consist of initial
identification of the model, estimation of coefficients and model checking (residual
analysis). An iterative process is conducted until the model residuals indicate that no
further modification is necessary. The fitted model is then used for forecasting. In this
study, SAS software is used to execute the ARIMA models. The steps involved in the
Box-Jenkins methodology are detailed as follows.
Step 1: Identification of model
Since the time series data must be stationary (i.e. varies about a fixed level), the first
step is to determine whether the series is stationary. To an experienced analyst, the plot
of the series along with the sample autocorrelation function may be used to determine
stationary if the series appears to increase or decrease with respect to time and the sample
autocorrelations fail to die out rapidly. Figure 3.5 shows an example of a non-stationary
time series, including the patterns of the sample autocorrelations. The data series shown
here represents the number of fatalities in Malaysia from 1981 to 2012. It can be observed
that the ACF decays slowly even though the PACF dies out. It shall be noted that a large
number of time series are non-stationary – however, they can be converted into a
stationary time series. The differencing method is usually used for this purpose. Thus, the
original series is replaced by a series of differences. An ARMA model is then defined for
the differenced series. Consequently, the changes in the model are taken rather than its
levels.
The original time series with order p = 1 and q = 1 has the following mathematical
representation. The constant term (0) may not be required in an ARMA model with
differencing.
𝑌𝑡− 𝑌𝑡−1 = 𝜙1(𝑌𝑡−1− 𝑌𝑡−2) + 𝜀𝑡− 𝜔1𝜀𝑡−1 (3.35)
If Yt – Yt-1 = Yt and Yt-1 – Yt-2 = Yt-1, the equation above can be written as:
∆𝑌𝑡 = 𝜙1∆𝑌𝑡−1+ 𝜀𝑡− 𝜔1𝜀𝑡−1 (3.36)
In some cases, first-order differencing is inadequate to yield a stationary data series.
Hence, second-order differencing is used for this purpose. This is achieved using the
following equation:
∆2𝑌
𝑡 = ∆(∆𝑌𝑡) = ∆(𝑌𝑡−1− 𝑌𝑡−2) = 𝑌𝑡− 2𝑌𝑡−1+ 𝑌𝑡−2 (3.37)
Most of the time, second-order differencing will yield a stationary data series, which
is evident when the data varies about a fixed level and the sample autocorrelations die out
fairly rapidly. The level of differencing (i.e. 1, 2 … ) to achieve stationarity is denoted by
the differencing method is to transform a non-stationary series into a stationary series. It
shall be noted that the forecasts for the original data series can always be computed
directly from the fitted model.
Once a stationary data series is attained, the next step involves computing and plotting
the autocorrelations and partial autocorrelations. This step is essential in order to compare
the computed autocorrelations and partial autocorrelations with the theoretical ones for
various ARIMA models. The theoretical correlations of common ARIMA models can be
referred to the literature, and some examples are shown in Figure 3.4. In order to simplify
the process, both of the sample autocorrelations and sample partial autocorrelations are
compared with
n
2
, where n is the number of observations in the time series. This process yields the tentative ARIMA models. The next step involves judging whether the
models are adequate and some measurements need to be made for this purpose. It shall
be highlighted that simple models are generally preferable over complex models, in
accordance with the principle of parsimony.
Step 2: Estimation of model
This step involves estimating the coefficients (parameters) of all tentative models by
minimizing the sum of squares of the fitting errors. The maximum likelihood and non-
linear least squares methods are used to identify the parameters which need to be
estimated. The non-linear least squares method is simply an algorithm that determines the
minimum of the sum of squared error function. Once the parameters and their standard
errors are known, the t value can be determined for each parameter and interpreted. The
parameters that are significantly different from zero are included in the fitted model.
Computing the residual mean square error is also useful to assess the fit and compare
different models. The residual mean square error is also used to calculate forecast error
limits. The formula used to calculate the residual mean square error is given by:
𝑆2 = ∑ 𝑒𝑡 2 𝑛 𝑡=1 𝑛 − 𝑟 = ∑𝑛 (𝑌𝑡− 𝑌̂𝑡)2 𝑡=1 𝑛 − 𝑟 (3.38) where: 𝑒𝑡= 𝑌𝑡− 𝑌̂𝑡 = Residual at time t n = Number of residuals
r = Total number of parameters estimated.
Figure 3.4: Examples of ACFs and PACFs of common ARMA models Source: Bisgaard & Kulahci (2008)
Figure 3.5: Example of a non-stationary data series and its ACF, PACF pattern
Step 3: Model checking
A model should be checked for its adequacy before it is used for forecasting. An
adequate model is obtained when the residuals cannot be used to improve the forecasts.
In other words, the residuals should be random. Histograms and normal probability plots
are useful to check for normality whereas time sequence plots are useful to check for
outliers. The criteria used to check the model are listed as follows:
1) The individual residual autocorrelations rk( e ) should be small and generally within
n
2
of zero.
2) The residual autocorrelations as a group should be consistent with those produced by
random errors. Checks on adequacy can be done using chi-square (Χ2) test based on
the Ljung-Box Q test statistic. The residual autocorrelations as a group is examined
using this test. The Q test statistic is given by:
𝑄 = 𝑛(𝑛 + 2) ∑𝑟𝑘 2(𝑒) 𝑛 − 𝑘 𝑚 𝑘=1 (3.39)
where:
n = Number of residuals
k = Time lag
m = Number of time lags included in the test
rk(e) = Sample autocorrelation function of the residuals lagged k time periods.
The Q test statistic is approximately distributed as a chi-square random variable with
m – r degrees of freedom, where r is the total number of parameters estimated in the
ARIMA model. If the p value associated with Q is small (which is the case in this study
where p < 0.05 and 0.1), the model is considered to be inadequate. Hence, a new model
or a modified model needs to be developed until a satisfactory model is achieved.
Checks for normality can be done using several methods. The SAS software provides
various test methods for this purpose, namely Shapiro-Wilk, Kolmogorov-Smirnov,
Cramer-von Mises and Anderson-Darling. The Kolmogorov-Smirnov test for normality
is used in this study. In this method, the normalized cumulative periodogram (Jk) is
compared with the cumulative distribution function of a uniform(0,1) random variable.
The normalized cumulative periodogram, Fj, of the series is given by:
𝐹𝑗 = ∑ 𝐽𝑘 𝑗 𝑘=1 ∑𝑚 𝐽𝑘 𝑘=1 , 𝑗 = 1, 2, 3, … , 𝑚 − 1 (3.40)
where m = n/2 if n is even or m = n−1/2 if n is odd. The test statistic is the maximum
absolute difference of the normalized cumulative periodogram and the uniform
cumulative distribution function. For m − 1 greater than 100, if the Bartlett’s
Kolmogorov-Smirnov statistic exceeds the critical value /(m – 1)1/2 (where α = 1.36 or α = 1.63 corresponding to 5% or 1% significance level, respectively), the null hypothesis that the series represents white noise will be rejected. The critical values for m − 1 < 100
can be found in the table of significance points of the Kolmogorov-Smirnov statistics with
a sample size of m − 1 (SAS Institute Inc., 2004).
Step 4: Forecasting with the model
Forecasts are usually made using a satisfactory model or a model that has been
determined to be the best model. Associating the confidence level to determine the upper
and lower bounds is also useful to observe the variations that have occurred. However,
the prediction interval may be an issue in this step. In general, the longer the forecast lead
time, the longer the prediction interval. It is important to monitor the forecast errors in
this step to ensure that the model provides reliable forecasts. If the magnitudes of the most
recent errors tend to be consistently larger than previous errors, the model needs to be re-
evaluated. The model also needs to be corrected if the recent forecast errors tend to be
consistently positive (underprediction) or negative (overprediction).
In most cases, a model having the best criteria results in unstable forecasts. For this
reason, modelling is first carried out using a model with only a few parameters. The need
for additional parameters will be evident from an examination of the residual
autocorrelations and partial autocorrelations. An MA parameter shall be added if the MA
behaviour is apparent in the residual autocorrelations and partial autocorrelations.
Conversely, the AR parameter will be increased if the residual autocorrelations tend to
show an AR process. Moreover, the least squares estimates of ARIMA models tend to be
highly correlated. When there are more parameters than necessary, this leads to ‘trade-