34
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

Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

Embed Size (px)

Citation preview

Page 1: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

Extensions for

Forecasting Models

1. Testing for trend (Daniel’s Test)2. The Double Moving Average Technique for

Trended Time Series3. The Triple Exponential Smoothing method for

Trend with seasonality time series (Holt-Winters)4. The autoregressive forecasting technique

Page 2: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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 SeriesThe 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”:

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

Time Series

1 2 3 4

Y4

Y3

Y2

Y1

Ranks4

3

2

1

*

*

*

*

Time

Time Series

1 2 3 4

Y2

Y4

Y3

Y1

Ranks4

3

2

1

t - Rt

1 – 1 = 0

2 – 4 = -2

3 – 2 = +1

4 – 3 = +1

Page 3: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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 trendH1: 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

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 - Rt

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.

Page 4: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

ExampleTest whether or not the following time series of sales exhibits any trend.

Time t Sales Ranks Difference Difference2 n=291 1 1 0 0 (diff2)= 1199.52 4 5.5 -3.5 12.253 3 2.5 0.5 0.25 rs = .7….4 6 15 -11 1215 6 15 -10 100 rcr = .36…

6 3 2.5 3.5 12.25(for n = 29 and =.05)

7 4 5.5 1.5 2.25

8 5 10.5 -2.5 6.25Reject the null hypothesis.

9 5 10.5 -1.5 2.2510 9 23.5 -13.5 182.2511 8 21 -10 10012 5 10.5 1.5 2.2513 4 5.5 7.5 56.2514 4 5.5 8.5 72.2515 7 18 -3 916 5 10.5 5.5 30.25 There is sufficient evidence to infer17 6 15 2 4 that trend exists at 5%18 7 18 0 0 significance level.19 11 27 -8 6420 7 18 2 421 8 21 0 022 5 10.5 11.5 132.2523 10 25 -2 424 8 21 3 925 12 29 -4 1626 5 10.5 15.5 240.2527 9 23.5 3.5 12.2528 11 27 1 129 11 27 2 4

Spearman table appears in the next page.

0

2

4

6

8

10

12

14

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29

Page 5: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

One-Tailed : .001 .005 .010 .025 .050 .100Two-Tailed : .002 .010 .020 .050 .100 .200 n

Testing for trend when n > 30In 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.

Page 6: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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 tMA(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,

The estimated level of the trended model as of time tL(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 -

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

See an example in the next page

Page 7: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

Example: Find the forecast for periods 14 and 15 of the following time series:

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)

1 5322 5463 5574 559

5 5546 5737 5748 604

9 61110 626

11 63612 64913 643

570.1667579.1667590.3333604.0616.6667628.1667

598.08

MA(13,6)

MA’(13,6)

Page 8: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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)StAs 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

Page 9: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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 procedureTo 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

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

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

Page 10: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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 5Q1 115.9 155.3 162.9 186.7 200.4Q2 30.1 78.5 66.3 100.7 123Q3 5.2 36.4 28.4 60.4 73.3Q4 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 5Q1 115.9 155.3 162.9 186.7 200.4Q2 30.1 78.5 66.3 100.7 123Q3 5.2 36.4 28.4 60.4 73.3Q4 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.711934Q2 0.536781 0.687581 0.88227 0.853571 0.905577 0.773156Q3 0.092733 0.294529 0.409104 0.511973 0.539665 0.369601Q4 1.303611 1.328494 0.963192 1.051918 1.07933 1.145309

Page 11: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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 trendT4 = [(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 + 1T4] S4+1-4 = [63.82 + (1)(8.225)](1.7119)F4+2 = (L4 + 2T4) S4+2-4 = [63.82 + (2)(8.225)](0.7731)

Iterating forwardL5 = (.1)(115.9/1.71) + (1-.1)(63.825+8.225) = 73.917 T5 = (.1) (73.917 – 63.825) + (1-.1) (8.225) = 8.411S5 = (.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+18.411)(0.7731) = 63.6348F5+4 = (73.917+42.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.

Page 12: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

4. Lagged Variables and Autoregressive Forecasting Technique

Forecasting with lagged explanatory variablesBy 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.ExampleA 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.SolutionWhile 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

Page 13: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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 modelThe 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 dataCORN TIME SOYBEAN CORN TIME SOYBEAN 48.3 1957 23.2 48.3 195752.8 1958 24.2 52.8 1958 23.253.1 1959 23.5 53.1 1959 24.254.7 1960 23.5 54.7 1960 23.562.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.

Page 14: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

Forecasting with autoregressive modelsAutoregressive 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.

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.

Yt Yt-1 Yt-2 Yt-3

abcdef

abcde

abcd

abc

Page 15: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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.32 9.5 9.33 9.9 9.5 9.34 10.7 9.9 9.5 9.35 11 10.7 9.9 9.56 11.8 11 10.7 9.97 11.3 11.8 11 10.78 11.2 11.3 11.8 119 10.2 11.2 11.3 11.8

10 10.2 10.2 11.2 11.311 9.9 10.2 10.2 11.212 10.5 9.9 10.2 10.213 11.7 10.5 9.9 10.214 14.4 11.7 10.5 9.915 14.8 14.4 11.7 10.516 14.5 14.8 14.4 11.717 14.2 14.5 14.8 14.418 14.4 14.2 14.5 14.819 11.3 14.4 14.2 14.520 9.2 11.3 14.4 14.221 10 9.2 11.3 14.422 10.3 10 9.2 11.3

The correlation matrix

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

  Yt Yt-1 Yt-2 Yt-3

Yt 1Yt-1 0.780102 1Yt-2 0.409381 0.7850962 1Yt-3 0.044332 0.4194285 0.792019 1

Page 16: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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.32 9.5 9.33 9.9 9.5 9.34 10.7 9.9 9.55 11 10.7 9.96 11.8 11 10.77 11.3 11.8 118 11.2 11.3 11.89 10.2 11.2 11.3

10 10.2 10.2 11.211 9.9 10.2 10.212 10.5 9.9 10.213 11.7 10.5 9.914 14.4 11.7 10.515 14.8 14.4 11.716 14.5 14.8 14.417 14.2 14.5 14.818 14.4 14.2 14.519 11.3 14.4 14.220 9.2 11.3 14.421 10 9.2 11.322 10.3 10 9.2

The new correlation matrix is:

Correlation matrix

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.

  Yt Yt-1 Yt-2

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

Page 17: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

o Testing the autocorrelation between Y t 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 = 0H1: Bp 0.

The test is based on the usual t statistic of the form (and also appears in the

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

  CoefficientsStandard

Error t Stat P-valueIntercept 4.420249 1.944454584 2.273259 0.038143Yt-1 1.109169 0.257828017 4.301973 0.000629Yt-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:

  CoefficientsStandard

Error t Stat P-valueIntercept 3.689145901 1.511399476 2.440881 0.025889Yt-1 1.189111461 0.207020362 5.743935 2.39E-05Yt-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.

Page 18: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

Forecasting with the autoregressive modelTo 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

Page 19: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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.

ExampleObserve the gross receipts of a certain restaurant collected quarterly from 1981 through 1985:

Year Qtr Gross receipts 81 1 135.9

2 50.13 25.24 93.1

82 1 162.92 66.33 28.44 128.1

83 1 155.32 78.53 36.44 85.7

84 1 175.72 90.73 50.44 114.1

85 1 178.42 933 43.34 116.6

Plotting the data we get the following graph

Gross receipts

0

50

100

150

200

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:

Page 20: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

  Yt Yt-1 Yt-2 Yt-3 Yt-4

Yt 1Yt-1 -0.04125 1Yt-2 -0.91692 -0.002971404 1Yt-3 -0.00972 -0.886922262 0.07688 1Yt-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 StatisticsMultiple R 0.936915R Square 0.877809Adjusted R Square 0.833376Standard Error 0.471344

Observations 16

ANOVA  df SS MS F Significance F

Regression 4 17.55618387 4.38905 19.7558 5.549E-05Residual 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.5091859Yt-1 0.004298 0.005446664 0.78915 0.4467 -0.0076898 0.0162863Yt-2 -0.00393 0.005290529 -0.74376 0.47261 -0.0155793 0.0077095Yt-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.

Page 21: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

Gross receipts Yt-1 Yt-2 Yt-3 Yt-4

135.950.1 135.925.2 50.1 135.9

93.1 25.2 50.1 135.9162.9 93.1 25.2 50.1 135.966.3 162.9 93.1 25.2 50.128.4 66.3 162.9 93.1 25.2128.1 28.4 66.3 162.9 93.1155.3 128.1 28.4 66.3 162.978.5 155.3 128.1 28.4 66.336.4 78.5 155.3 128.1 28.485.7 36.4 78.5 155.3 128.1175.7 85.7 36.4 78.5 155.390.7 175.7 85.7 36.4 78.550.4 90.7 175.7 85.7 36.4114.1 50.4 90.7 175.7 85.7178.4 114.1 50.4 90.7 175.7

93 178.4 114.1 50.4 90.743.3 93 178.4 114.1 50.4

116.6 43.3 93 178.4 114.1

The results are:SUMMARY OUTPUT

Regression StatisticsMultiple R 0.953996R Square 0.910108Adjusted R Square 0.896278Standard Error 15.98205

Observations 16

ANOVA  df SS MS F Significance F

Regression 2 33618.58 16809.29 65.80888 1.58E-07Residual 13 3320.536 255.4259

Total 15 36939.12      

  Coefficients Standard Error t Stat P-value Lower 95%Upper 95%

Intercept 88.55895 32.42704 2.731022 0.017148 18.5046 158.6133Yt-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).

Page 22: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

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 testH0: There is no trendH1: There is trendSince 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 < -zIn 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 T0based on the MAD criterion

(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

Page 23: Trend/No Trend Forecasting Models - California State ...mihaylofaculty.fullerton.edu/sites/zgoldstein/361b/... · Web viewForecasting Models Testing for trend (Daniel’s Test) The

‘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).