# Trend/No Trend Forecasting Models by ISCI8UCB

VIEWS: 0 PAGES: 24

• pg 1
```									    Extensions for

Forecasting Models

1. Testing for trend (Daniel’s Test)
2. The Double Moving Average Technique for
Trended Time Series
3. The Triple Exponential Smoothing method for
Trend with seasonality time series (Holt-Winters)
4. The autoregressive forecasting technique
1. Testing the Presence of a Trend

It is very important to test the existence of trend before deciding whether a stationary or a
non-stationary model should be used to perform a forecast. We have already introduced
the validity test for the linear regression model as a possible method that can be applied
for this purpose, when the error random variable is assumed to be normally distributed.
However, when this is not the case, we can apply a non-parametric test called Daniel’s
Test.

Daniel’s Test for the Trend of a Time Series
The idea of Daniel’s test is built on the calculation of differences between the time and
the ranks of the times series values for each point in time; specifically if there is a trend,
than the ranks of the ranked data should form a series similar to the time periods
themselves. The following graph demonstrates the situation in a “perfect world”:
Time Series

Ranks
4   Y4                                     *

3       Y3
*
2       Y2                *
1       Y1        *

Time
1       2       3       4

For the case shown above the difference between ‘t’ and the rank Rt assigned to Yt (that
is (t – Rt)) is always zero. Since the time series is random, its behavior is not ‘perfect’ and
therefore sometimes the differences are positive, other times negative, and of course
zeros too. Observe the following example:
Time Series
t - Rt
Ranks                                                          1 – 1 =0
4   Y2                                                       2 – 4 = -2
*                                3 – 2 = +1
3        Y4                               *                4 – 3 = +1

2        Y3                       *

1        Y1       *

Time
1       2       3       4
So, the values of (t – Rt)2 should be small when the time series is mostly trended. Thus, a
statistic that builds on these differences should get a small value when trend is present,
and therefore, if the statistic is sufficiently small we have an indication the time series is
trended. More specifically, the statistic is a coefficient called The Spearman’s Correlation
Coefficient calculated by rs = 1- [a function of‘t – Rt’).
Because of the way the statistic is calculated the null hypothesis is rejected if
rs is sufficiently large. More formally,

H0: There is no trend
H1: There is trend

Testing for trend when n  30
 Reject the null hypothesis if |rs|> rcr, where the statistic rcr is a value taken from
the Spearman table provided below (it depends on ‘n’ and 

6 d 2
t
rs  1       2
n(n  1)

Definitions:
 For convenience let Rt = the rank of the data point that belongs to time period “t”.
Equal value data points are given the average ranks that would be assigned to
them had there been no ties. Also define:
 dt = t - R t
 n = the sample size (how many data points were recorded).

The following example demonstrates the procedure when n < 30. The large sample case
is discussed later.
Example
Test whether or not the following time series of sales exhibits any trend.

Time t     Sales    Ranks         Difference      Difference2                       n=29
2
1         1              1               0            0                         (diff )= 1199.5
2         4             5.5           -3.5        12.25
3         3             2.5            0.5         0.25                         rs = .7….
4         6             15             -11          121
5         6             15             -10          100                         rcr = .36…
(for n = 29
6         3             2.5           3.5         12.25                         and =.05)
7         4             5.5           1.5          2.25
Reject the null
8          5         10.5           -2.5         6.25                            hypothesis.
9          5         10.5           -1.5         2.25
10          9         23.5          -13.5       182.25
11          8           21            -10          100
12          5         10.5            1.5         2.25
13          4             5.5         7.5        56.25
14          4             5.5         8.5        72.25
15          7             18           -3            9
16          5         10.5            5.5        30.25                            There is sufficient evidence to infer
17          6             15            2            4                            that trend exists at 5%
18          7             18            0            0                            significance level.
19         11             27           -8           64
20          7             18            2            4
21          8             21            0            0
22          5         10.5           11.5       132.25
23         10             25           -2            4
24          8             21            3            9
25         12             29           -4           16
26          5         10.5           15.5       240.25
27          9         23.5            3.5        12.25
28         11             27            1            1
29         11             27            2            4

Spearman table appears in the next page.

14

12

10

8

6

4

2

0
1     3   5   7     9    11   13   15   17   19   21   23   25   27   29
One-Tailed :       .001        .005   .010   .025     .050      .100
Two-Tailed :       .002        .010   .020   .050     .100       .200      n

Testing for trend when n > 30
In cases where the number of observations is greater than 30, rs is approximately
normally distributed. The test statistic is calculated as follows:

H0 is rejected if |z| > z/2.

Once the existence of trend has been established, we have several options in selecting a
good trended model. Regression analysis and the Holt’s model are two such methods that
have already been introduced. Here we present two other trend models.
2.     The Double Moving Average Forecasting Technique for a
Trended Time Series
This method is based on the central location of the average.
Notation
 MA(t,k) denotes the k-period moving average as of time t for the original
time series.
 MA'(t,k) denotes the k-period moving average as of time t for the series of
moving averages.
 T(t) denotes the trend value (slope) of the time series as of period t.

In order to build a forecast based on a trended model, we need to determine the
slope and the level of the forecast as of time t. This is done next.
The estimated slope (trend value) of the trended model as of time t
MA(t,k) is centered (k-1)/2 periods behind t, at t-(k-1)/2.
Explanation: A ‘k-period’ moving average contains the periods t, t-1, …, t-k+1.
The center of this sequence is (t + t-k+1)/2 = t-(k-1)/2
MA'(t,k) is centered (k-1) periods behind t, at t-(k-1).
Explanation: A ‘k-period’ moving average of the k-period moving averages is
centered (k-1)/2 behind its last period which has just been found to be located at
t-(k-1)/2.

On an average basis MA(t,k) - MA'(t,k) = [(k-1)/2]T(t). This is so because the
average is changing by T(t) units per period. Therefore,

T(t) 
2
MA(t, k)  MA' (t, k)
k 1

The estimated level of the trended model as of time t
L(t) is the expected location of the time series as of time t. So, on an average
basis, the value of MA(t,k) is [(k-1)/2]T(t) units different from L(t). Thus,
L(t) – MA(t,k) =[(k-1)/2]T(t) = MA(t,k)-MA'(t,k). This leads to -

L(t)  2MA(t, k)  MA' (t, k)

With this two coefficients we can now build a forecast into the future:

F(t  k)  L(t)  kT(t)

See an example in the next page
Example:
Find the forecast for periods 14 and 15 of the following time series:
1    532
2    546
3    557
4    559
5    554
6    573     570.1667
7    574     579.1667
8    604     590.3333
598.08
604.0
9    611                      3
616.6667
10   626                         MA’(13,6)
628.1667
11   636
MA(13,6)
12   649
13   643

Calculating the model coefficients:

T(13) = 2/(k-1)[MA(13,6) – MA’(13,6)] = 2/(6-1)[628.1667 – 598.08] = 12.03468

L(13) = 2MA(13,6) – MA’(13,6) = 2(628.1667) – 598.08 = 658.2534

Forecasting the time series for t +1= 14 and t +2= 15: (Note that t = 13).

F(14) = F(13+1) = L(13) + 1T(13) = 658.2534 + 12.03468

F(15) = F(13+2) = L(13) +2T(13) = 658.25 + 2(12.03468)
3. The Holt-Winters (H-W) triple Exponential Smoothing
Model for a
Trend with Seasonality Time Series

The model presented here is designed to forecast future values of time series with trend
and seasonality. This model is multiplicative, as opposed to the additive approach taken
by the multiple regression model used before to forecast the same type of a time series.
To describe the time series the trend component is multiplied by the seasonal index. As a
result three parameters are to be estimated (smoothed). The first two deal with the linear
trend, and the third one deals with the seasonal adjustment. Specifically, the time series to
be forecasted can be formulated as follows:

Yt = (b0 + b1t)St

As you can see, there is a linear part for this model (b0+b1t) that takes care of the trend
effects, and a multiplicative part where the trend effect is multiplied by St, a positive
coefficient that represents the seasonality effect at each time‘t’. In case no seasonal
adjustment is needed at a certain period on top of the trend effects, then St=1. If the actual
time series value falls above the trend line, then St>1; if the actual time series value falls
below the trend line, then St<1. For example, if the straight line results with the value 10
at a certain t, and if for this t the seasonality index is St=.8, then the value of the time
series at this point is 10(.8) = 8.

Let p represent the number of seasons per cycle. The Holt – Winters procedure uses the
following three recursive formulas:

Lt = Yt/St-p + (1-)Lt-1

Tt = (Lt – Lt-1) + (1 – )Tt-1

St =  Yt/Lt + (1 – )St-p,

Explanation:
 The parameter Lt represents the linear part of the time series at time’t’. Note that
Yt/St-p = b0+b1t, is indeed a linear function of t. The exponential smoothing approach
to estimating the linear part of the time series is utilized by that we weigh Yt/St-p
against Lt-1. Yt/St-p is considered new information for the linear component because of
the existence of the new value Yt; Lt-1 is the previous value of L that encompasses
previous old information. These two estimates are combined using the smoothing
coefficient .
 The parameter Tt represents the slope of the trend line at time’t’. One estimate of this
slope can be obtained by determining the change in the trend line value for two
consecutive periods (Lt – Lt-1). This is considered new information because of the
presence of Lt. The other estimate Tt-1, is the trend estimate from the last period which
encompasses information of all the previous periods. These two estimates are
weighed against one another using the exponential smoothing approach with a
smoothing coefficient .
   The parameter St is the seasonal index pertaining to time’t’. One possible estimate of
this index can be obtained by Yt/Lt (note that when dividing Y by the linear part of
the formula we are left with the seasonal effect). A second estimate of the seasonal
index is the last estimate made p periods earlier (recall that our cycle covers p
periods; that is, St and St-p estimate the index of the same season at two different
points in time!). With these two estimates we can now apply the smoothing procedure
using the coefficient .

The forecast for the time series k periods ahead is

Ft+k = (Lt + kTt)St+k-p.
Comment: If k exceeds one cycle we need to pay a attention to the seasonal cycles,
because St+k-p yields yet uncalculated seasonal coefficients. Thus, a slight change in the
formula is called for. Particularly, let k =mp+n (where m and n are integers greater than
or equal to 1). Then we’ll use St-p+n instead of St+k-p. For example, if the forecast required
is Ft+p+1 (i.e. k = p+1) we’ll use St-p+1; For Ft+p+2 we’ll use St-p+2; For Ft+2p that can be
written as Ft+p+p use St-p+p = St; and for Ft+2p+1 we’ll use St-p+1 (same as for Ft+p+1, as should
be). The example below demonstrates these concepts.
Initializing the Holt-Winters procedure
To initialize the HW method we need at least one complete season's data to determine
initial estimates of the seasonal indices St-p. A complete season's data consists of p
periods. We need to estimate the trend factor from one period to the next. To accomplish
this, it is advisable to use two complete seasons; that is, 2p periods.

Initial values for the trend factor

The general formula to estimate the initial trend is given by
1  Yp 1  Y1 Yp  2  Y2             Yp  p  Yp 
T0                                ...              
p       p             p                     p     

Initial values for the seasonal indices

Calculate the average of the observations that belongs to each cycle in the
given observed time series (Ai is the average of cycle i). Then

Ai 
Y   t
for the periods that belong to cycle i
p

Continue on next page
Step 2: Divide the observations by the appropriate yearly mean. For example,
if we recorded quarterly data for 6 years, we calculate the following ratios
(Focus on each column)
1       2       3        4      5        6

y1/A1 y5/A2 y9/A3 y13/A4 y17/A5 y21/A6
y2/A1 y6/A2 y10/A3 y14/A4 y18/A5 y22/A6
y3/A1 y7/A2 y11/A3 y15/A4 y19/A5 y23/A6
y4/A1 y8/A2 y12/A3 y16/A4 y20/A5 y24/A6

Step 3: Now the seasonal indices are formed by computing the average of
each row. Thus the initial seasonal indices (symbolically) are:
S1 = ( y1/A1 + y5/A2 + y9/A3 + y13/A4 + y17/A5 + y21/A6)/6
S2 = ( y2/A1 + y6/A2 + y10/A3 + y14/A4 + y18/A5 + y22/A6)/6
S3 = ( y3/A1 + y7/A2 + y11/A3 + y15/A4 + y19/A5 + y22/A6)/6
S4 = ( y4/A1 + y8/A2 + y12/A3 + y16/A4 + y20/A5 + y24/A6)/6

Example:

The following time series seems to behave in a repetitive manner, but trend is also
suspected to affect its behavior. Forecast the next 7 periods of this time series using the
H-W triple exponential smoothing method with the following smoothing coefficients:
 = .1,  = .1,  = .02. Data appears in the file Holt-Winters, and is provided also next:

Year 1     Year 2     Year 3    Year 4     Year 5
Q1    115.9       155.3     162.9      186.7      200.4
Q2     30.1        78.5      66.3      100.7        123
Q3      5.2        36.4      28.4       60.4       73.3
Q4     73.1        85.7     128.1      124.1      146.6

Solution:
Observing the data we notice that we have 5 years of data collected quarterly. So a cycle
is considered one year and there are 4 seasons (p=4). To initiate the H-W procedure we
need to find the initial values of the trend, the seasonal factors, and the linear part of the
model. Specifically, we need to find T4, S1, S2, S3, S4, and L4.
Calculating the initial seasonal indices:
Step 1: Average the observations for each year (cycle).
Year 1    Year 2     Year 3     Year 4      Year 5
Q1    115.9      155.3     162.9       186.7       200.4
Q2     30.1       78.5      66.3       100.7         123
Q3      5.2       36.4      28.4        60.4        73.3
Q4     73.1       85.7     128.1       124.1       146.6
Year
Avg          56.075    96.425     88.975     117.975     135.825
Step 2: Calculate the ratios {Quarterly value/Year average) for each quarter in
each year, then average the ratios for each quarter across the 5 years. These
averages are the initial seasonal indices for the quarters.
Ratios
Year 1     Year 2     Year 3      Year 4      Year 5    Initial Si
Q1      2.066875   1.689396   1.745434    1.582539    1.475428   1.711934
Q2      0.536781   0.687581   0.88227     0.853571    0.905577   0.773156
Q3      0.092733   0.294529   0.409104    0.511973    0.539665   0.369601
Q4      1.303611   1.328494   0.963192    1.051918    1.07933    1.145309

For example: the ratio for quarter 1 in year 1 is 115.9/56.075=2.06, and for
quarter 1 in year 2 is 155.3/96.425=1.689. The average ratio (the initial seasonal
index) for quarter 1 is (2.066+1.689+…)/5=1.711…
Determining the initial trend (T4)
The initial trend is determined from the data gathered in the first two years.
Differences are calculated for each quarter between the two years and then
averaged over 4 periods (from quarter 1 first year to quarter 1 second year there
are 4 quarters). These average differences are then averaged to obtain the initial
trend
T4 = [(155.3 – 115.9)/4+ (78.5 – 30.1)/4+ (36.4 – 5.2)/4+ (85.7 – 73.1)/4]/4 =
8.225
Determining the initial linear part of the model (L4):
L4 = Y4/S4 = 73.1/1.145 = 63.82.
Just an exercise:
Performing the “forecast” for periods 5 and 6:
If hypothetically we needed to perform forecasts for t = 5, 6 we could proceed as follows
(recall that Ft+k = (Lt + kTt)St+k-p)
F4+1 = [L4 + 1T4] S4+1-4 = [63.82 + (1)(8.225)](1.7119)
F4+2 = (L4 + 2T4) S4+2-4 = [63.82 + (2)(8.225)](0.7731)

Iterating forward
L5 = (.1)(115.9/1.71) + (1-.1)(63.825+8.225) = 73.917
T5 = (.1) (73.917 – 63.825) + (1-.1) (8.225) = 8.411
S5 = (.02)(155.3/73.917)+(1-.02)(1.711) = 2.19

With these estimates we could perform a forecast for t +k. For example,
F5+1 = (73.917+18.411)(0.7731) = 63.6348
F5+4 = (73.917+42.19)
(Notice that this is the first time we are using an updated seasonal factor (S5)).

F5+5 = F5+4+1 = (L5+5T5)S5-4+1 = (73.917+5 8.411)(.7731)
(Notice that k=5 is longer than one cycle, and therefore we use St-p+n = S5-4+1 rather than
St+k-p =S5+5-4. The reason is apparent now: S5+5-4 = S6 is not available yet.
4. Lagged Variables and Autoregressive Forecasting
Technique

Forecasting with lagged explanatory variables
By now the time series Yt was related to an explanatory variable called “TIME”. For
example, the linear trend model could be formulated as Yt = 0 +  1T +t. When other
explanatory time related variables can be related to the time series value, it is possible
previous time periods have an effect on the current value of Yt. For example, sales in
period t might be affected by advertisement expenditure in period t and period t-1. In
this case, an additive model of the form Yt = B0 + B1Xt + B2Xt-1 + t could be used to
forecast sales in future periods, given a future advertising expenditure plan. The variable
Xt-1 is one period lagged. In fact any lag that contributes to the amount of Yt explained by
the model can be added. In general the lagged variable model can be formulate by

Yt = B0 + B1Xt + B2Xt-1 + B3Xt-2 + … + t

Estimates of the coefficients Bi can be determined using the multiple regression
technique. The following example demonstrates the implementation of this concept, and
also discusses statistical information that can be obtained from the regression output.
Example
A local government of a rural agricultural region tries to develop tools to predict the
annual yield for various plants harvested in that area. It was suggested that information
about the yield of soybean can help predict the same year yield for corn. Records for corn
and soybean yield for the years 1957 to 2000 were gathered (see the file CORN). You
were asked to forecast the corn yield for 2001.
Solution
While in this problem we are mainly interested in constructing the lagged variable model,
we’ll show other models you are familiar with too.
First let us see whether time should be considered an explanatory variable for the yield of
corn. We run a regression of the form CORNt = b0 + b1TIME to check whether there are
linear relationship between corn sales and time. From the data we get
CORNt = -3571.67+1.853TIME. For this model r2 = .8577, so the data fits the line very
well. When testing H0: 1 = 0 vs. H1: 1  0 the null hypothesis is rejected with p-value
, so there is overwhelming evidence that a linear relationship exists between TIME and
CORN. With this conclusion we can now use the model to make prediction for a given
year. In particular, the corn yield for the year 2001 is
CORN2001 = -3571.67+1.853(2001) = 136.81.
Secondly, we add soybean yield to the equation, and check whether each one of these
explanatory variables indeed have linear relationships with corn yield. The equation we
get from Excel is CORNt = -1552.76 + (.789)TIME + (2.912)SOYBEANt,
with r2 = .92 and Significance F So the model fits the data very well and is very useful.
However, this model might have only theoretical value, because one needs to know the
soybean yield in 2001 in order to forecast the corn yield for the same year(?!). It is more
practical such a forecast will be based on the year of 2000 yield information. This leads
to the one-period lag regression model.
The lagged model
The new model we try to estimate has the form

CORNt = b0 + b1TIME + b2SOYBEANt-1.

Note that in this model we predict the corn yield for year t based on t itself and on the
known value of the explanatory variable soybean from the previous year t-1. This is an
operational model provided it can be validated. Before running Excel we reorganize the
raw data as follows:
Original data                          Reorganized data
CORN       TIME    SOYBEAN           CORN          TIME    SOYBEAN
48.3      1957       23.2            48.3         1957
52.8      1958       24.2            52.8         1958       23.2
53.1      1959       23.5            53.1         1959       24.2
54.7      1960       23.5            54.7         1960       23.5
62.4      1961       25.1            62.4         1961       23.5
25.1
Note that the soybean yield from 1957 now explains (hopefully) the corn yield from
1958. We run the regression model in Excel and get the following equation:
CORNt = -4504.12 + (2.346)t – (1.418)SOYBEANt-1. The coefficient of determination
is r2 = .86 with Significance F So the model fits the data well and can be considered
very useful. The forecast requested is CORN2000 = -4504.12 + 2.346(2001) –
1.418(SOYBEAN2000) = –4504.12 + 2.346(2001) – 1.418(38.1) = 135.67.

Comment: The limitation of this model is that it can perform a forecast for one period ahead
only.; This is so because as of year 2000 a forecast 2 or more years ahead requires the yield
data for soybean for 1 or more years ahead, and (obviously) this data are not available as of
2000.
Forecasting with autoregressive models
Autoregressive models use the possible autocorrelation between the time series values to
predict values of the time series in future periods. Particularly, a first order
autocorrelation refers to the magnitude of association between consecutive observations
in the time series. The time series autoregressive model that expresses first order
correlation is

Yt = B0 + B1Yt-1 + t.

A p-order autocorrelation refers to the size of correlation between values p periods apart.
The autoregressive model that expresses a p-order time series is

Yt = B0 + B1Yt-1 + B2Yt-2 + … +BpYt-p + t.

The autoregressive forecasting model takes advantage of all the information within p
periods apart from period t in order to build a forecast for period t+1. The coefficients B0,
Bt, Bt-1, …, Bt-p+1 are estimated using regression analysis. Note that the time series itself
is used multiple times as “independent variables”. The following chart demonstrates the
use of the time series to perform the regression analysis. Note how the data is organized.

Yt        Yt-1    Yt-2    Yt-3
a
b         a
c         b       a
d         c       b          a
e         d       c          b
f         e       d          c

In this chart the regression can be run from the fourth row down; therefore the first three
rows of information are lost. This model tries to predict the value of Yt using Yt-1, Yt-2,
and Yt-3 as explanatory variables (for example, Y5= e in the fourth row is explained by the
values Y4=d, Y3=c, and Y2=b).

Determining the number of lagged variables.
The problem of losing some information as demonstrated above when running an
autoregressive model might become serious if the data set is not large while the order ‘p’
used is. One does not want to include too many period in a model if they do not
contribute significant information. We can use several methods to discover the periods
relevant to the autoregressive model.
 Observing the autocorrelation matrix
 Testing the autocorrelation between Yt and Yt-p
o Observing the autoregressive model
We select periods that show high correlation to Yt. If the correlation between Yt-p
and Yt is low, the period t-p is eliminated from the data and the correlation matrix
is recalculated, this time with respect to the first t-p-1 columns. We stop the
elimination process when all the periods are sufficiently correlated with Yt.

Example
Develop an autoregressive model for the data provided below on annual gross revenue of
a certain company. The data covers 22 years of records taken annually. Arbitrarily, we
start by formulating the 3-period autoregressive model. That is

Yt = b0 + b1Yt-1 + b2Yt-2 + b3Yt-3.

After the data was organized to fit the 3-period model (as shown below) the correlation
matrix was created (using Excel). Observe the data in the next page and the correlation
matrix.

t         Yt         Yt-1          yt-2            yt-3
1         9.3
2         9.5         9.3
3         9.9         9.5           9.3
4        10.7         9.9           9.5         9.3
5         11         10.7           9.9         9.5
6        11.8         11           10.7         9.9
7        11.3        11.8           11         10.7
8        11.2        11.3          11.8         11
9        10.2        11.2          11.3        11.8
10        10.2        10.2          11.2        11.3
11         9.9        10.2          10.2        11.2
12        10.5         9.9          10.2        10.2
13        11.7        10.5           9.9        10.2
14        14.4        11.7          10.5         9.9
15        14.8        14.4          11.7        10.5
16        14.5        14.8          14.4        11.7
17        14.2        14.5          14.8        14.4
18        14.4        14.2          14.5        14.8
19        11.3        14.4          14.2        14.5
20         9.2        11.3          14.4        14.2
21         10          9.2          11.3        14.4
22        10.3         10            9.2        11.3

The correlation matrix
Yt          Yt-1            Yt-2          Yt-3
Yt                1
Yt-1       0.780102             1
Yt-2       0.409381     0.7850962                1
Yt-3       0.044332     0.4194285         0.792019               1
The first column in the matrix represents the autocorrelation between Yt (the revenue in
year t) and the lagged data (the revenue in year t-1, t-2, and t-3). Notice that Yt and Yt-3
have very low correlation. Therefore, Yt-3 is eliminated from the model and the process
repeats with a 2-period model.

Yt = b0 + b1Yt-1 + b2Yt-2.

One column (Yt-3) is eliminated from the data. Note that the amount of data lost is now
smaller. See the data below.

t         Yt              Yt-1          yt-2
1         9.3
2         9.5              9.3
3         9.9              9.5           9.3
4        10.7              9.9           9.5
5         11              10.7           9.9
6        11.8              11           10.7
7        11.3             11.8           11
8        11.2             11.3          11.8
9        10.2             11.2          11.3
10        10.2             10.2          11.2
11         9.9             10.2          10.2
12        10.5              9.9          10.2
13        11.7             10.5           9.9
14        14.4             11.7          10.5
15        14.8             14.4          11.7
16        14.5             14.8          14.4
17        14.2             14.5          14.8
18        14.4             14.2          14.5
19        11.3             14.4          14.2
20         9.2             11.3          14.4
21         10               9.2          11.3
22        10.3              10            9.2
The new correlation matrix is:

Correlation matrix

Yt          Yt-1          Yt-2
Yt              1
Yt-1        0.791569        1
Yt-2        0.443326    0.7999989         1

Now both Yt-1 and Yt-2 exhibit reasonable correlation with Yt and can be used in the
autoregressive model.

Since there is no criterion that helps determine what a sufficiently large correlation is, we
present now a second method, that helps in testing the linear relationship between the Yt-p
and the dependent variable Yt.

o Testing the autocorrelation between Yt and Yt-p

If Yt and Yt-p are correlated, the coefficient bp associated with Yt-p in the regression
equation is not equal to zero. Thus, after running the regression model we test
H0: Bp = 0
H1: Bp  0.
b p  Bp
The test is based on the usual t statistic of the form t           (and also appears in the
Sbp
Excel printout).
The rejection region has two tails. t > t,n-2p-1 or t<-t,n-2p-1.
If the null hypothesis is not rejected then bp could be equal to zero, that is there is no
linear relationship between Yt-p and Yt. Drop the column that pertains to Yt-p and rerun
the regression model. Repeat the process until the highest order variable is found to be
correlated with Yt. Let us resolve the previous problem using this method.

The 3-period autoregressive model: We are using the data presented above and run
multiple regression on the 3-period model presented above (Yt is the dependent variable,
Yt-1 is X1, Yt-1 is X2 and Yt-3 is X3). Note that the regression must be run over the period
t = 4, t=5, and on. The relevant excerpt from the Excel printout obtained is
Standard
Coefficients       Error       t Stat    P-value
Intercept     4.420249     1.944454584   2.273259   0.038143
Yt-1          1.109169     0.257828017   4.301973   0.000629
Yt-2          -0.34851     0.377687538   -0.92276   0.370739
Yt-3          -0.13957     0.258655077   -0.53958   0.597406

The large p-value of the t-test indicates that bt-3 = 0 and therefore we can drop this
variable from the regression. We continue by rerunning the 2-period autoregressive
model. Based on the data presented above for this case we get the following printout:
Standard
Coefficients       Error       t Stat     P-value
Intercept    3.689145901     1.511399476   2.440881    0.025889
Yt-1         1.189111461     0.207020362   5.743935    2.39E-05
Yt-2         -0.50700405     0.203049893   -2.49694    0.023092

The p value of the test for bt-2 is .023. If our selected significance level is .05, we can
reject the hypothesis that bt-2 = 0 in favor of the hypothesis that bt-2  0. The 2-period
autoregressive model can be used, and correspondingly the regression equation is:

Yt = 3.689 + 1.189Yt-1 – 0.507Yt-2

This equation can now be used to perform forecasts. See next page.
Forecasting with the autoregressive model
To make a forecast for years 23, 24, and 25 as of t=22, we proceed as follows:

F23 = 3.689 + 1.189Y22 – .507Y21 = 3.689 + 1.189(10.3) – .507(10) = 10.866
F24 = 3.689 + 1.189F23 – 0.507Y22 = 3.689 + 1.189(10.866) – 0.507(10.3) = 11.386

F25 = 3.689 + 1.189F24 – 0.507F23 = 3.689 + 1.189(11.386) – 0.507(10.866) = 11.717
Using an Autoregressive technique to forecast a Seasonal Time Series
The seasonal component in a time series creates repetitive behavior that can be reflected
by autocorrelation between observations located at some distance from one another.
Therefore, it is a typical case where autoregressive models can work.

Example
Observe the gross receipts of a certain restaurant collected quarterly from 1981 through
1985:
Year     Qtr       Gross receipts
81      1                135.9
2                 50.1
3                 25.2
4                 93.1
82    1                162.9
2                 66.3
3                 28.4
4                128.1
83    1                155.3
2                 78.5
3                 36.4
4                 85.7
84    1                175.7
2                 90.7
3                 50.4
4                114.1
85    1                178.4
2                    93
3                 43.3
4                116.6
Plotting the data we get the following graph
Gross receipts

200

150

100

50

0
0          5            10              15     20          25

A repetitive pattern and a mild trend seem to be present.
Checking the correlation matrix we realize that there is a very high correlation between
Yt and Yt-2 ; Yt and Yt-4. Observe the correlation matrix:
Yt                     Yt-1               Yt-2         Yt-3         Yt-4
Yt                    1
Yt-1           -0.04125                    1
Yt-2           -0.91692         -0.002971404                     1
Yt-3           -0.00972         -0.886922262               0.07688           1
Yt-4           0.932371         -0.057970996               -0.8809     0.03667                1

A 4-period autoregressive model seems to be appropriate. When running the regression
analysis for the autoregressive model of the form
Yt = B0 + B1Yt-1 + B1Yt-2 + B2Yt-3 + B3Yt-4,

we get the following results:

SUMMARY OUTPUT

Regression Statistics
Multiple R                0.936915
R Square                  0.877809
Standard Error            0.471344
Observations                         16

ANOVA
df                    SS               MS          F          Significance F
Regression                      4                   17.55618387      4.38905     19.7558          5.549E-05
Residual                        11                  2.443816129      0.22217
Total                           15                            20

Coefficients             Standard Error       t Stat     P-value       Lower 95%       Upper 95%
Intercept                       1.7651              1.246752732      1.41576     0.18453          -0.9789854   4.5091859
Yt-1                      0.004298                  0.005446664      0.78915      0.4467          -0.0076898   0.0162863
Yt-2                       -0.00393                 0.005290529     -0.74376     0.47261          -0.0155793   0.0077095
Yt-3                      0.021925                  0.005247181      4.17836     0.00154          0.0103756    0.0334736
Yt-4                       -0.01503                 0.005467864      -2.74888    0.01893          -0.0270652    -0.002996

The 4-period model is appropriate and can be used for forecasting. However, because
reducing the model size is always preferable provided we do not lose usefulness and level
of fit, we turn again to the correlation matrix and check the model consisting of the data
with the strongest autocorrelation to Yt, (Yt-2 and Yt-4). That is, the model we check is:

Yt = B0 + B1Yt-2 + B2Yt-4

Observe first how the input data is organized, then look at the regression results.
Gross
receipts             Yt-1              Yt-2         Yt-3           Yt-4
135.9
50.1            135.9
25.2            50.1              135.9
93.1            25.2              50.1         135.9
162.9           93.1              25.2         50.1           135.9
66.3            162.9             93.1         25.2              50.1
28.4            66.3              162.9        93.1              25.2
128.1           28.4              66.3         162.9             93.1
155.3           128.1             28.4         66.3           162.9
78.5            155.3             128.1        28.4              66.3
36.4            78.5              155.3        128.1             28.4
85.7            36.4              78.5         155.3          128.1
175.7           85.7              36.4         78.5           155.3
90.7            175.7             85.7         36.4              78.5
50.4            90.7              175.7        85.7              36.4
114.1           50.4              90.7         175.7             85.7
178.4           114.1             50.4         90.7           175.7
93             178.4             114.1        50.4              90.7
43.3             93               178.4        114.1             50.4
116.6           43.3               93          178.4          114.1
The results are:
SUMMARY OUTPUT

Regression Statistics
Multiple R                0.953996
R Square                  0.910108
Standard Error            15.98205
Observations                         16

ANOVA
df                SS             MS               F        Significance F
Regression                      2                 33618.58     16809.29         65.80888        1.58E-07
Residual                        13                3320.536     255.4259
Total                           15                36939.12

Upper
Coefficients        Standard Error      t Stat          P-value     Lower 95%        95%
Intercept                 88.55895                32.42704     2.731022         0.017148         18.5046    158.6133
Yt-2                       -0.41528               0.170979     -2.42886         0.030396        -0.78466    -0.04591
Yt-4                      0.565828                0.178647     3.167302          0.00742       0.179885     0.951771

This model appears to have a better fit (larger r-square) and its validity seems to be sound
(significance F).
41. The closing price of a certain stock over the past 60 days has been as follows (see
stock.xls):
Perform a forecast for future stock prices over the next 10 days.

Solution:
Step 1: First we need to check, which time-series components need to be included in the
forecasting model.
Test for the presence of a trend – the Daniel’s test
H0: There is no trend
H1: There is trend
Since n = 60 we run Daniel’s test for large samples. First, from the data provided in
‘Stock.xls’ we calculate rs = -0.85435 (see the worksheet). From this we obtain
z = rs/(n-1)1/2 = -.85435/(60-1)1/2 = -1.7087

At  = .10 significance level z/2 = z.05 = 1.645. Since |-1.7087| > 1.645 we reject the null
hypothesis and infer that there is sufficient evidence in the data to include trend in the
forecasting technique.
A comment: Since the rejection of H0 occurs with a negative value of z, we can infer that
the trend is negative (stock prices decline over time). If we suspected upfront there was a
decline, we could use a one-tail test of the form H1: There is a negative trend and use a
left hand tail rejection region of the form: z < -z
In this case the null hypothesis can be rejected even at 5% significance level since
(-1.708 < -1.645).

Step 2: We can now plot the time series to see whether a clear seasonality exists. No such
effects seem to be present. We’ll continue with a forecasting technique that includes only
trend.
Apply the following models:
(a) The Holt’s method. Find the optimal values of the  L0, and T0based on
(b) The Double Moving-Average method. Find the optimal number of periods to
include in the moving average based on the MAPE criterion).
(c) The autoregressive model with first order autocorrelation.

Step 3: Select the model that performs the best among the three models developed above.

Step 4: Perform the price forecast for the next 10 days. (Just for the sake of practice,
please perform the forecast using all the three techniques).

Solution with the Holt’s model:
Select any initial values for the coefficients  L0, and T0.
Use Solver to minimize the criterion of choice (MAD for part (a); MAPE for part (b)).
Thus, the target cell is the value of the criterion in the template (for example cell J4 for
MAPE). The changing cells are the four parameters of interest (cells E3:E6). The only
constraints are 1, 0, Note: Under Options in Solver, make sure ‘Assume
Linear Model’ and ‘Assume Non-Negative’ are unchecked (this is so because (i) the
objective function minMAD is non-linear, and (ii) L0 and T0 can be non-positive).

```
To top