Sei sulla pagina 1di 11

276 Chapter 5 Model Building and Residual Analysis

FIGURE 5.39 (for Exercise 5.16) SAS output of outlying and influential observation diagnostics for the hospital
labor needs model y '" + f3 1X1 + P1X1 + P3X3 + + e
std Error Student
Cbs Residual Residua! ResidUil!
1 -'-161 .0116 33'"'.,", -1.319
,
11.,",562 319.'-1 0.2'-12
3 -e5'-1.5710 333.3 -0.16"'1
"
68.1689 325.8 0.211
5 11.192"'1 3"'18.1 0.222
5 -485.9099 342.2 -1."120
7 Z20.63"18 3"10.1 0.63'-1
8 351.5516 3'-18.'-1 1.009
S -1"'1'-1.6'-160 3"11.1 -0.4Z'i
10 -13'1.0155 3ZZ.9 -0."115
11 12:1.1552 3'-12.6 2: .IZ2
"
-20"1.6980 319.3 -0.6"11
13 162:.0928 331.5 0."180
'"
2G6.8015 197."1 1 .352
15 -373.62'-16 205.2 -1.821
15 183.7'-127 161."1 1.098
17 -16.9195 111.'-1 -0.655
(Exercise 5.16 Continued)
important effect due to the inefficiency of large
hospitals.
b. Given the largehospital inefficiency, is hospital 14
an outlier with respect to its y value? Explain your
answer.
c. Identify the hospital having the largest Cook's D.
Does this hospital seem less influential than
hospitall7 did when we used all 17 observations
(including hospital 14) and no dummy variable to
perfonn the regression analysis? See the output in
Figure 5.20 (page 256). Explain your answer.
d. Although the remedial actions taken in Exercise
5.15 (remove hospital 14) and in this exercise (use
a dummy variable) have lessened the influence of
the larger hospitals (hospitals 14, 15, 16, and 17),
these larger hospitals generally seem more
influential than the small to medium-sized
hospitals. This probably implies that we need more
data eoncerning large hospitals to develop a better
regression model for evaluating hospitals whose
efficiency the navy questions. Since we do not now
have such data, we will use the data we have to
choose a model for evaluating questionable hospitals.
To do this, first note that the s for the dummy variable
model of this exercise is 363.8542 and the s for the
model of Exercise 5.15 is 387.1598. Also, note that
both of these values of s are substantially smaller
than thes of614.7794 for the model using all 17
hospitals and no dummy variable.
Cook's Hat Diag
-Z-t 0 1
,
0 RStudent H
iHI 0.070 -1.'13S0 0.1553
I 0.003 0.2321 0.2293
*1 0.022 -0.1"190 0.1609
I 0.002 0.20Z5 0.1983
I 0.001 0.2128 0.08"'19
**1
0.053 -1."1903 0.1153
1* 0.007 0.6112 0.08'-16
1** O.OIS 1.0099 0.0831
I 0.005 -0.'-1091 0.1211
I 0.009 -0."1002 0.212"1
1****
0.115 2.5112 0.113'-1
*1 0.02:5 -0.62:"15 0,2291
I 0.001 0.'-16"'13 0.1396
1**
0.871 1."1058 0.7058
***1
1."122 -2.0"'192 0.G819
1**
0.898 1.1081 0.708"1
*1 0.738 -0.G386 0.8958
Next, consider a questionable large hospital
(D
L
= 1) for which Xray = 56,194, BedDays::
14,077.88, and Length = 6.89. Such a hospital has
the following 95% prediction intervals for labor
needs; {15,175, l7,030] if using the dummy
variable model in this exercise, [14,906, 16,886]
if !-Ising the model in Exercise 5.15, and [14,511,
17,618] if using the model of Exercise 4.4 (page
199), which does not employ a dummy variable
and uses all 17 hospitals. Which of the three
models gives the shortest prediction interval?
e. Figure 5.40(a) presents the plots of the residuals
versus the predicted values for the model in Exercise
5.15 when hospital 14 is omitted. Figure 5.40(b)
presents the same graph for the dummy variable
model in this exercise when using all 17 hospitals.
Which residual plot has the most "horizontal band"
appearance (or constant variance)?
f. Combining all the available information in Exercises
4.4,5.14,5.15, and 5.16, and in Figure 5.20, which
of the three models seems best for evaluating the
efficiency of questionable hospitals?
5.17 Consider the difference between the least
squares point estimate b
j
of 13
1
, computed using all n
observations, and the least squares point estimate
by> of computed using all n observations except for
observation i. SAS calculates this difference for each
observation and divides the difference by its standard
error to fonn the difference in estimate of p) statistic.
Exercises 277
FIGURE 5.40 (for Exercise 5.16) SAS plots of residuals versus predicted values
'" R
'.
e
s
d
u
a
I -500
e
5000 10000 15000
Predicted
(a) ModeJ in Exercise 5.15 with hospital 14 removed
R
e
e
i
d
u
a
I
c
'"
*"
'"
-200
...,00
5000 10000
Predicted
15000
(b) Dummy variable mode! for 17 hospitals
FIGURE 5.41 (for Exercise 5.17) SAS output of the difference in estimate of statistics
Obs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
INTERCEP
Dfbetas
-0.0477
0.0138
00307
0.2416
00035
-0.0881
0.0045
0.0764
0.0309
01787
-0.0265
-04387
-0.0671
-0.8544
0.9616
0.9880
00294
Xl
Dfbetas
0.0157
-0.0050
-00084
-0.0217
0.0014
-00703
-0.0008
-00319
0.0243
-02924
0.0560
03549
00230
1.1389
01324
-1.4289
-3.0114
If the absolute value of this statistic is greater than 2
(a sometimes-used critical value for this statistic), then
removing observation i from the data set would
substantially change the least squares point estimate of
For example, consider the hospital labor needs
model of Section 5.4 that uses all 17 observations to
relate y toxI' X2, andxJ. Also consider the columns
labeled "Dfbetas" in Figure 5.41. Notice that there are
four such columns-one for each model parameter-
which are labeled INTERCEP, Xl, X2, and X3. Each
of these columns contains the difference ill estimate of
X2
Dfbetas
-0.0083
0.0119
00060
0.0251
-00099
0.0724
-0.0180
00063
0.0304
03163
-0.0792
-0.3782
-0.0243
-0.9198
-00133
1.7339
1.2688
X3
Dfbetas
0.0309
-0.0183
-0.0216
-0.1821
0.0074
0.0401
0.0179
-0.0314
-0.0873
-02544
0.0680
03864
0.0390
0.9620
-0.9561
-1.1029
03155
Pi statistic related to the column's parameter label for
each observation. We see that for observation 17
"INTERCEP Dftbetas" (= .0294), "X2 Dfbetas"
(= 1.2688), and "X3 Ofbetas" (= .3155) are all less
than 2 in absolute value. This says that the least
squares point estimates of 130, 132, and probably
would not change substantially if hospital 17 were
removed from the data set. However, for observation
17 "Xl Ofbetas" (= -3.0114) is greater than 2 in
absolute value. What does this say?
(Continues on page 278)
280 Chapter 6 Time Series Regression
6.1 MODELING TREND BY USING
POLYNOMIAL FUNCTIONS
We sometimes can describe a time series Yr by using a trend model. Such a model is
defined as follows,
The trend model is
where
y,
TR,
e,
y,=TR/+E,
the value of the time series in period I
the trend in time period t
the error term in time period t
This model says that the time series y, can be represented by an average level (denoted
p.,) that changes over time according to the equation III = TR/ and by the error term
CI' This error term represents random fluctuations that cause the Yt values to deviate
from the average level P.r'
Some useful trends are given in the following box.
NO TREND. LINEAR TREND, AND QUADRATIC TREND
1. No trend, which is modeled as TR
t
= 130, implies that there is no long-
run growth or decline in the time series over time; see Figure 6.1(a).
2.
Linear trend, which is modeled as TRI = 130 + J3lt, implies that there is a
straight-line long-run growth (if the slope 131 is greater than zero) or
decline (if 131 is less than zero) over time; see Figure 6.1(b) and (c).
3.
Quadratic trend, which is modeled as TRr = 130 + J3lt + J 3 i ~ implies
that there is a quadratic (or curvilinear) long-run change over time.
This quadratic change can either be growth at an increasing or decreasing
rate-see Figure 6.1(d) and (e)-or decline at an increasing or decreasing
rate; see Figure 6.1(f) and (g).
These trends are the most commonly used. However, other, more complicated trends also
exist. For example, we can model trend by using the pth..order polynomial function.
6.1 Modeling Trend by Using Polynomial Functions 281
FIGURE 6.1 Different types of trend
TR, = Po
TR, = fh + {3,I, where 11, > 0 TR, = Po + {H, where fl. < 0
(a) No long-run growth or decline (b) Straight-line growth (c) Straight-line dedlne
TR, = {J. + fl,1 + fl,e TR, = {3. + p,t + {3,e
~
(d) Growth at an increasing rate
(f) Decline at an increasing rate
(e) Growth at a decreasing rate
TR, = {3. + p,t + {3i!
(g) Decline at a decreasing rate
The pth-order polynomial trend model is
Yr=TR/+,
= 130 + J3l t + J3i + ... + J3
p
t
P
+ ,
Third-order (p = 3) and higher-order (p > 3) polynomials model trends with
one or more reversals in curvature. For instance, a third-order polynomial trend
TRI = 130 + J3lt + 132(2 + J3J?
describes a trend with one reversal of curvature.
Least squares point estimates of the parameters in these trend models may be
obtained by using regression techniques. Here we assume that the error term ( satis-
fies the constant variance, independence, and normality assumptions. Violations of the
constant variance assumption would be suggested by a fanning-out or funneling-in
282 Chapter 6 Time Series Regression
EXAMPlEG.1
FIGURE 6.2
IMP IN plot of cod
catch (tons) versus
time (months)
residual plot versus time. The nonnality assumption can be checked by constructing
histograms, stem-and-Ieaf diagrams, and normal plots of the residuals. We discuss
checking the independence assumption in Section 6.2.
The Bay City Seafood Company owns a fleet of fishing trawlers and operates a fish processing
plant. In order to forecast its minimum and maximum possible revenues from cod sales and
to plan the operations of its fish processing plant. the company desires to make both point
forecasts and prediction interval forecasts of its monthly cod catch (measured in tons). The
company has recorded the monthly cod catch for the previous two years (years 1 and 2).
The cod catch history is given in Table 6.1. When these data are plotted, they appear to fluc-
tuate randomly around a constant average level (see the 3M? IN plot in Figure 6.2). Since
the company subjectively believes that this data pattern will continue in the future, it seems
reasonable to use the regression model
Yt =TRr+ CI =
to forecast the cod catch in future months.
TABLE 6.1 Cod Catch (In Tons)
Month Year 1 Year 2
January 362 276
February 381 334
March 317 394
April 297 334
May 399 384
June 402 314
July 375 344
August 349 337
September 386 345
October 328 362
November 389 314
December 343 365
______ -, __________ -, ____
/I, (\/\'/\ A A A i

o 5 10 15 20 25
TIme
6.1 Modeling Trend by Using Polynomial Functions 283
FIGURE 6.3 MINITAB output of a regression analysis of the cod catch data using the model Yt "" + (I
Predictor Coef 58 Coef T P
l-Ioconstant
Intercep 351. 292 6.904 50.88 0.000
5 = 33.82 Durbin-Natson statistic 2.12
Predicted Values for Observations
New Obs
1
Fit S8 Fit 95.0% CI 95. OS PI
351. 2 9 6.90 337.01, 365.57) 279.88, 122.71)
The MINITAB output of a regreSSion analysis of the cod catch data using this model
is given in Figure 6.3. Note that the least squares point estimate of can be shown to
be equal to
- Yl+h+"'+h4
Y = 24
362 + 381 + ... + 365 = 351.29
24
which is the mean of the n = 24 observed cod catches. Thus
Yf = Y "" 351.29
is the point predidion of the cod catch (Yt) in any future month. Moreover, a 100{1 - a)%
predidion interval for y, is
where
I,(y, - y)'
5 =
n
= 33.82
[
- (,-'I r71'I
1
( 1 )]

(362 - 351.29)' + ... + (365 351.29)'
24 -1
If we wish to compute a 95% prediction interval, we use
= = tF.5iSl = 2.069
and we compute the interval to be
[y + (11 n) 1 = [351.29 + (1/24) 1
= [351.29 71.421
= [279.88.422.711
284 Chapter 6 Time Series Regression
EXAMPLE 6.2
FIGURE 6.4
JMP IN plot of
calculator sales
versus time
(months)
This interval, which is also given on the MJNITAB output of Figure 6.3, says that Bay City
Seafood is 95% confident that the cod catch Yl in any future month will be betvveen
279.88 tons and 422.71 tons.
For the past two years, Smith's Department Stores, Inc., has carried a new type of
tronic calculator called the Bismark X-12. Sales of this calculator have generally been
Increasing over these two years. Smith's uses an inventory policy that attempts to
ensure that its stores will have enough Bismark X-12 calculators to meet practically
all of the demand for the Bismark X-12, while ensuring that Smith's does not need-
lessly tie up its money by ordering many more calculators than it can reasonably
expect to sell. In order to implement this inventory policy in future months, Smith's
requires both point predictions and prediction intervals for total monthly Bismark X-
12 demand.
The monthly calculator demand data for the past two years are given in Table 6.2. A
JMP IN plot of the demand data versus time is shown in Figure 6.4. The demands appear
TABLE 6.2 Calculator Sales Data
Month Year 1 Year 2
January 197 296
February 211 276
March 203 305
April 247 308
M,y 239 356
June 269 393
July 308 363
August 262 386
September 258 443
October 256 308
November 261 358
December 288 384


00




o 5 10 15 20 25
Time
6.1 Modeling Trend by Using Polynomial Functions 285
to fluctuate randomly around an average level that increases over time in a linear fashion.
Furthermore, Smith's believes that this trend will continue for at least the next two years.
Thus it is reasonable to use the regression mode!
Yl:= TRI + Er:= Po + PIt + El
to forecast calculator sales in future months. The least squares point estimates of 131 and
Po are, respectively,
" (it)(h)
2:ty 1.,1 t"l
f4 - 55
1
), - 1,,1 t - 24 = 8.07435
- 55
rr
- " (it)'
2: t
2
- -'-"--
24
and
24 24
LY, Lt
b = y-f4t = = 198.02899
o 24 1 24
The 5AS output of a regression analysis of the demand data using the linear trend model
is given in Figure 6.5. Forthis model both the intercept and the variable tare significant-
each has a p-value less than .0001. Furthermore, R2 := .7726 and s := 31.67061.
Using this model, the point forecast of a future demand YI is
Yt := be + a,t := 19R02899 + 8.07435t
Therefore, point forecasts of Bismark X-12 demand in January and February of year 3 are,
respectively,
Yzs = 19R02899 + 8.07435(25) = 399.9
and
Y25 = 198.02899 + R07435(26) = 408.0
Moreover, a 95% prediction interval for Y2S is
[
" 1 (25-11'] 1 [ 647121
YzSt{.02S]S 1+-+ 24 = [399.971.3 = 328., .
24
'"'
Note that these point predictions and the prediction interval are given on the SA5 output
of Figure 6.5. This figure also shows that a 95% prediction interval for YZ6 is [336.0,
479.9J. The prediction intervals can be used to help implement Smith's inventory policy.
For instance, if Smith's stocks 471 Bismark X-12 calculators in January of year 3, we can
be very sure that monthly demand will be met.
286 Chapter 6 Time Series Regression
FIGURE 6.5 SAS output of a regression analysis of the calculator sales data usmg the model Yr =. Po + P1t + Er
Analysis of Variance
SUM of Nean
Source OF Squares Square F Value Pr > r-
Hodel
,
1'-191"1 1'1S1'-1 1'1.75 <.GOOI
Error
"
ZZ061 1003.02135
Corrected Total
"
970'-11
Root NSE 31.61061 R-Square 0.1726
Dependent Nean Z98.95033 AdJ R-sq 0.152:3
Coeff Var 10.59365
paraMeter Estimates
ParaMeter Standard
Variable Label OF Estimate Error Value Pr > I t I
Intercept Intercept 19a.OZass 13.3"1'i'"l3 tl.{.8'i <.0001
T
0.01"135 0.93392 B.G5 (.OOGI
Dep Var Predicted Std Error
Obo y Value Nean Predict 95% CL Nean 95% CL Predict
25 399.8077 13.3'i'"l'i 3n.Z130 "127.5623 32:8.51"15 '-171.1608
2G '"101.9520 1"1.1531 318.5180 "137.3'160 336.0080 "I1S.SISI
27 "IIG.03G"! 15.0051 381.{.9161.{ 'i'-l1.156'i 3'"13.3561 'l8B.7167
ZB 'i2'"1.1! 01 15.SS37 391.232:3 '"I5G.9892: 350.5503 '"197.5611
Durbin-Watson 0 I.S82:
TABLE 6.3 loan Requests (in $10005)
Month
January
February
March
April
May
June
July
August
September
October
November
December
EXAMPLE 6.3
Year 1 Year 2
297
249
340
406
464
481
549
553
556
642
670
712
808
809
867
855
965
921
956
990
1019
1021
1033
1127
The State University Credit Union, a savings institution open to the faculty and staff of
State University, handles savings accounts and makes loans to members. In order to plan
its investment strategies, the credit union requires both point predictions and prediction
intervals of monthly loan requests (in thousands of dollars) to be made by the faculty and
staff in future months.
The credit union has recorded monthly loan requests for its past tvv'o years of opera-
tion (see Table 6.3). AJMP IN plot of the loan request data versus time is given in Figure 6.6.
This plot suggests that Joan requests tend to fluctuate around an average level that
FIGURE G.G
JMP IN plot of loan
requests (){ S1000)
versus time
(months)
6.1 Modeling Trend by Using Polynomial Functions 287
12oo..,------------------"
1000

800 /-


Time
FIGURE 6.7 MINITAB output of a regression analysis of the loan request data using the
model y, = Po + Plt+ P2t2 + E/
The regre2sion equation is
y = 200 + 50.9 Time - 0.568 TimeSQ
Predictor Coet SE Coef T
Constant 199.62 20.85 9.58
Time 50.937 3.8<42 13.26
TimeSQ -0.5677 0.B92 -3.80
S = 31.25 R-Sq = 98.7% R-sq(adj) =
Analysis of variance
Source
Regression
Re2idual Error
Total
DF
2
H
23
SS
1566730
2050<4
1581234
statistic = 2.10
Predicted Values for New Ob2ervation2
MS
783365
976
P
0.000
0.000
0.001
98.6%
F
802.33
p
0.000
Fit
1118.21
IBO.19
5E Fit
20.85
2<4.4;1
95.0% CI
107<4.85, 1161.56)
1089.37, 1191.01)
95.0% PI
10<40.09, 1196.32)
1057.70, 1222.68)
increases at a decreasing rate over time. The quadratic trend of loan requests is consis
tent with the credit union's historical membership pattern, and the credit union expects
this trend to continue in future months. Thus 'It seems reasonable to forecast loan requests
by using the quadratic regression model
Yt = TRt + E, =!lo + !lIt + pi + 1
The MIN1TAB output of a regression analysis of the loan request data using this
model is shown in Figure 6.7. This figure shows that the least squares point estimates of
Po, Ph and P2 are b
o
= 199.62, b, = 50.937, and b
2
= -0.5677. Furthermore, each of
the terms in this model-the intercept, the linear term t, and the quadratic term t1-is
288 Chapter 6 Time Series Regression
significant (both Po and t have a p-value of .000, and t
2
has a p-value of .001). In addi-
tion, we find that R2 =:: .987 and s "" 31.25. Using this model, the pOint forecast of a future
value of loan requests Yl is
YI =- bo + bit +
= 199.62 + 50.937t - .5677t
2
For example, pOint forecasts of loan requests in January and February of year 3 are,
respectively,
Y
25
=:: 199.62 + 50.937{25) - .5677(25)2
= 1118.21
Y26 =:: 199.62 + 50.937(26) - .5677(26)2
::;: 1140.19
These point predictions are given in the output of Figure 6.7. This figure also shows that
95% prediction intervals for Y2S and Y26 are, respectively, [1040.09, 1196.32J and [1057.70,
1222.68]. For example, the first interval says that the credit union can be very sure that
loan requests in January of year 3 will be no higher than $1,196,320.
6.2 DETECTING AUTOCORRELATION
The validity of the regression methods illustrated in Section 6.1 requires that the inde-
pendence assumption be satisfied. However, when time series data are being analyzed,
this assumption is often violated. It is quite common for the time-ordered error terms
to be autocorrelated. We say that error terms occurring over time have positive auto-
correlation if a positive error term in time period t tends to produce, or be followed
by. another positive error term in time period t + k (a later time period) and if a neg-
ative error term in time period t tends to produce, or be followed by, another negative
error term in time period t + k. In other words, positive autocorrelation exists when
positive error terms tend to be followed over time by positive error tenos and negative
error terms tend to be followed over time by negative error terms. An example of pos-
itive autocorrelation in the error terms is depicted in Figure 6.8(a). This figure illus-
trates that positive autocorrelation in the error terms can produce a cyclical pattern over
time. Thus positive autocorrelation in the error termS means that greater than average
values of YI tend to be followed by greater than average values of YI' and smaller than
average values ofy, tend to be followed by smaller than average values ofYI'
Error terms occurring over time have negative autocorrelation if a positive error term
in time period t tends to produce, or be followed by, a negative error term in time period
t + k and if a negative error term in time period t tends to produce, or be followed by, a
positive error term in time period t + k. In other words, negative autocorrelation
exists when positive error tenns tend to be followed over time by negative error terms
and negative error terms tend to be followed over time by positive error terms. An
example of negative autocorrelation in the error terms is depicted in Figure 6.8(b).
FIGURE 6.8
positive and
negative
autocorrelation
FIGURE 6.9
Little or no
autocorrelation in
the error terms:
random pattern
6.2 Detecting Autocorrelation 289
Time t

(a) POSItiVe autocorrelatIon in the error terms: Cyclical pattern
Timet
2456713;
(b) Negative autocorrelation in the error terms: Alternating pattern

Timet
2 3 4 6 7 9

This figure illustrates that negative autocorrelation in the error termS can produce an
alternating pattern over time. It follows that negative autocorrelation in the error terms
means that greater than average values of YI tend to be followed by smaller than
age values of YI and smaller than average values of Yl tend to be followed by greater
than average values of YI' An example of negative autocorrelation might be provided
by a retailer's weekly stock orders. Here a larger than average stock order one week
might result in an oversupply and hence a smaller than average order the next week.
The independence assumption says that the error terms display no
positive or negative autocorrelation. This says that the error terms occur in a random
pattern over time, as illustrated in Figure 6.9. Such a pattern would imply that these
error terms are statistically independent, which would in turn imply that the time-
ordered values of YI are statistically independent.
290 Chapter 6 Time Series Regression
EXAMPLE 6.4
FIGURE 6.10
MINITAB prot of
residuals versus
time for the cod
catch model
Since the residuals are point estimates of the error terms, a residual plot against
time can be used to detect violations of the independence assumption. If a residual plot
against ?me has a cyclical app.earance, the error terms are positively autocorrelated,
and the mdependence assumptIOn does not hold. Another way to detect positive
correlation is to look at the signs of the residuals. Letting + denote a
positive residual and - denote a negative residual, we call a sequence of residuals with
the same sign (for instance, + + +) a run. If positive autocorrelation exists the sil1ns
of the residuals should display relatively few runs offairly long duration. Fo; instU:ce,
the pattern + + + + - - - + + + - - - - + + + + - - - in the time-ordered resid-
uals would indicate that positive autocorrelation exists.
If a plot of the time-ordered residuals has an alternating pattern, the error terms are
negatively autocorrelated.lf we look at the signs of the time-ordered residuals, nel1ative
autocorrelation is characterized by many runs of relatively short duration. For ex:Uple,
the pattern + - + - + + - + - + - - + - in the time-ordered residuals would indicate
that negative autocorrelation exists and that the independence assumption is violated.
However, if a plot of the time-ordered residuals displays a random pattern, the
error terms have little or no autocorrelation. This suggests that these error terms are
independent.
Figures 6.10, 6.11 (page 292), and 6.12 (page 292) give plots of the time-ordered residu-
als for the no trend cod catch model of Example 6.1, the linear trend calculator sales
model of Example 6.2, and the quadratic trend loan requests model of Example 6.3. None
of these plots exhibit a well-defined cyclical pattern or a well-defined alternating pattern.
That is, each residual plot probably displays a random pattern. For each model we conclude
that little or no autocorrelation exists and that the independence assumption holds.
One type of positive or negative autocorrelation is called first-order autocorre-
lation. It says that 10" the error term in time period t, is related to 10,_\, the error term
-];

Obnrvilticn Order
6.2 Detecting Autocorrelation 291
in time period t - 1, by the equation
c, = 9IC,_1 + a,
Here we assume that $ r is the correlation coefficient between error terms separated
by one time period and at> a2,'" are values randomly and independently selected from
a normal distribution having mean zero and a variance independent of time. We now
present the Durbin-Watson test, which is a fonnal test for first-order (positive or neg-
ative) autocorrelation.
DURBIN-WATSON TEST: (FIRST-ORDER) POSITIVE AUTOCORRELATION
The Durbin-Watson statistic is
feel - eHf
d= '"'
"
Lel
2
I"')
where eJ, e2,"" en are the time-ordered residuals.
Consider testing the null hypothesis
Ho: The error terms are not autocorrelated
versus the alternative hypothesis
Ha: The error terms are positively autocorrelated
Durbin and Watson have shown that there are points (denoted dr.,u. and
du;J such that if a: is the probability of a Type I error, then
1. If d < dL.u., we reject Ho.
2. If d > du,a., we do not reject rio.
3. If dL.a S; d S; du,a, the test is inconclusive.
Here small values of d lead to the conclusion of positive autocorrelation. because
if d is small, the differences (e, - e,_I) are small. This indicates that the adjacent resid-
uals e, and et-l are of the same magnitude, which in tum says that the adjacent error
terms 10, and lOt-I are positively correlated.
tIn this and subsequent chapters we use the subscripted symbol (rather than the sometimes used p) to
denote the parnmeter(s) in an autoregressive process. We do so because this notation is consistent with that
used when writing autoregressive terms in the Box-Jenkins methodology.
292 Chapter 6 Time Series Regression
FIGURE 6.11
SAS plot of
residuals versus
time for the
calculator sales
model
FIGURE 6.12
MINITAB plot of
residuals versus
time for the loan
request model
EXAMPLE 6.5
..
5 10 15 20
Time
"1----------------,
10 12 14 16 18 20 22
ObsarvllUon Ordw
So that the Durbin-Watson test may be easily done, tables containing the points
dL,a du.a. have been constructed. These tables give the appropriate dL,a. and du.a. points
for values of a; k, the number of independent variables; and n, the number of
observatIons. !ablesA5 andA6 in Appendix A give values for a = .05 and a = .01.
Note that, for mstance, k equals 1 for the simple linear trend model.
the calculator sales analysis of Example 6.2. The linear trend model of this exam-
ple Yields the prediction equation
YI = 198.02899 + 8.07435t
The residuals obtained by using the linear trend model are computed using the equation
er = Yr - Yr = Y
r
- (198.02899 + 8.07435t)
For example, the first three reSiduals are:
e1 = Yl - YI = 197 - (198.02899 + 8.07435(1 = -9.1033
ez = h - Y2 = 211 -(198.02899+8.07435(2 = -3.1777
e3 = YJ - Y3 = 203 - (198.02899 + 8.07435(3 = -19.2520
6.2 Detecting Autocorrelation 293
If we wish to test
Ho: The error terms are not autocorrelated
versus the alternative
Ha: The error terms are positively autocorrelated
we compute the Durbin-Watson statistic to be
"
L(e
r
-et_l
d=l
m
2
24
Le;
,.,
(-3.1777 -(-9.1 0332 + (-19.2520 - (-3.17772 + .. + (-7.8133 - (-25.7390<
(-9.1033)2 + (-3.1777)2 + ... + (-7.8133)2
" 1.682
Notice that the Durbin-Watson statistic is given on the 5A5 output of Figure 6.5. To test
for positive autocorrelation at a = .05, we use (see Table AS) dL, os = 1.27 and dupos =
1.45. Since d = 1.682 > du ..os = 1.45, we do not reject Ho. That is, there is no evidence
of positive (first-order) autocorrelation.
As a second example, the MINITAB output of Figure 6.7 shows that the
Durbin-Watson statistic for the loan requests quadratic trend model is 2.10. Since d =
2.10 > du ..os = 1.55 (note that k ::;;: 2 for the quadratic trend model), we do not
reject Hij. Again we conclude that there is no evidence of positive
autocorrelation.
The Durbin-Watson test can also be used to test for negative autocorrelation.
DURBIN-WATSON TEST: (FIRSTORDER)
NEGATIVE AUTOCORRELATION
Consider testing the null hypothesis
Ho: The error tenns are not autocorrelated
versus the alternative hypothesis
The error tenus are negatively autocorrelated
Durbin and Watson have shown that based on setting the probability of a Type I
error equal to Il, the points dL,a. and du.a. are such that
1. If (4 - d) < dL.a., we reject lIn.
2. If (4 - d) > du,a., we do not reject Ho.
3. If dL,a. (4 - d) :s; du,a.. the test is inconclusive.
294 Chapter 6 Time Series Regression
Here large values of d (and hence small values of 4 - d) lead to the conclusion
of negative autocorrelation because if d is large, this indicates that the differences
(e/ - eH ) are large. This says that the adjacent error terms 00/ and EH are negatively
autocorrelated. As an example, for the data and model in Example 6.2 we see that
(4 - d) = (4 - 1.682) = 2.318 > d
u
..
os
= 1.45
Therefore, on the basis of setting a equal to ,05, we fail to reject the null hypothesis
of no negative autocorrelation. That is, there is no evidence of negative (first-order)
autocorrelation.
Finally, we can also use the Durbin-Watson statistic to test for positive or nega-
tive autocorrelation.
DURBIN-WATSON TEST: (FIRST-ORDER) POSITIVE
OR NEGATIVE AUTOCORRELATION
Consider testing the null hypothesis
Ho: The error terms are not autocorrelated
versus the alternative hypothesis
Ha: The error terms are positively or negatively autocorrelated
Durbin and Watson have shown that, based on setting the probability of a Type I
error equal to a,
1. If d < dL,0J2 or if (4 - d) < dL,0J2, we reject Ro.
2.
If d > du,0J2 and if (4 - d) > d
u
,0J2, we do not reject H
o
'
3.
If dL,0J2 S d S du.0J2 or dL,0J2 S (4 - d) S d
U
,0J2, the test is inconclusive,
Before we conclude our presentation of the Durbin-Watson test, several comments
are relevant. First, the validity of the Durbin-Watson test depends on the assumption
that the population of all possible residuals at any time t has a normal distribution.
Second, positive autocorrelation is found in practice more commonly than negative
autocorrelation. Therefore, the first test we presented (the test for positive autocorre-
lation) is used more often than the others. Third, most regression computer packages
print the Durbin-Watson d-statistic. Fourth, first-order autocorrelation is not the only
type of autocorrelation. Time series data can exhibit more complicated autocorrelated
error structures. In such cases autocorrelation is detected by using what is called the
sampJe autocorrelation function. We discuss this function in subsequent chapters.
\ben the error terms for a time series are autocorrelated, we must model the auto-
correlation, We begin to explain how this is done in Section 6.6.
6.3 Types of Seasonal Variation 295
6.3 TYPES OF SEASONAL VARIATION
FIGURE 6.13
A time series
exhibiting constant
seasonal variation
FIGURE 6.14
A time series
exhibiting
increasing seasonal
variation
We now consider time series that display seasonal variation. We define two types of
seasonal variation. If the magnitude of the seasonal swing does not depend on
of the time series, we say that the time series exhibits constant seasonal
A time series with constant seasonal variation is illustrated in Figure 6.13. This ttme
series appears to possess an increasing linear trend. Note that the size of the s.easonal
swing remains the same as the level of the time series increases. If the ma?mtude, of
the seasonal swing depends on the level of the time series, we say that. the senes
exhibits increasing seasonal variation. Figure 6.14 illustrates a time senes
exhibits increasing seasonal variation. Notice that the magnitude of the seas?nal
(the size of the peaks and troughs) becomes larger as the level of the hme senes
increases. .
When a time series displays increasing seasonal variation, it is practI.ce
to apply a transformation to the data in order to p.roduce a transformed senes that
plays constant seasonal variation, A transformation of the form
y; = y/" where a < A < 1

Time
Time
296 Chapter 6 Time Series Regression
EXAMPLE 6.6
is often used. For instance. we might employ the square root transfonnation
l :::: y;S
or the quartic root transfonnntion
YI* :::: y/
5
It can be shown that as the power II. approaches zero, the transformed value y}.
approaches In YI' the natural logarithm ofYI' In fact, it is common practice to employ
the transfonnation
Y; :::: InY
I
in order to obtain a transformed series that displays constant seasonal variation.
Traveler's Rest, Inc., operates four hotels in a midwestern city. The analysts in the operat-
ing division of the corporation were asked to develop a model that could be used to obtain
short-term forecasts (up to one year) of the number of occupied rooms in the hotels. These
forecasts were needed by various personnel to assist in decision making with regard to
hiring additional help during the summer months, ordering materials that have long deliv-
ery lead times, budgeting of local advertising expenditures, and so forth.
The available historical data consisted of the number of occupied rooms during each
day for the previous 15 years, starting on the first day of January. Because it was desired
to obtain monthly forecasts, these data were reduced to monthly averages by dividing each
monthly total by the number of days in the month. The monthly room averages for the
first 14 of the 15 years, denoted by Yt. Y2,"" YlI;)8, are given in Table 6.4 and plotted in
Figure 6.15.
At the outset it was decided to perform all analysis with the data from the first 14
of the previous 15 years so that forecasts for the 15th year could be used as a check on
the validity of the model. Figure 6.15 shows that the monthly room averages follow a
strong trend and that they have a seasonal pattern with one major and several minor peaks
during the year. It also appears that the amount of seasonal variation is increasing with
the level of the time series. This suggests that a transformation should be used in order
to obtain a transformed series that displays constant seasonal variation.
Figure 6.16 gives a JMP IN plot of the square roots (Y; :::: d)of the room averages.
This plot suggests that the square root transformation is not strong enough to equal-
ize the seasonal variation. Figure 6.17 shows a plot of the quartic roots (y; :::: yr) of
the room averages. The quartic root transformation seems to produce a transformed
series with constant seasonal variation. Figure 6.18 gives a plot of the natural logarithms
(Y; :::: InYr) of the room averages. It might be concluded that this transformation has
also equalized the seasonal variation. However, careful examination of the plot suggests
that the logarithmic transformation may be overtransforming the data (note a slight fun-
neling in appearance in the plot after t =: 120 or so). Since both the logarithmic and
the quartic root transformations seem to be reasonably effective, and since the loga-
rithmic transformation is commonly used, we will try using the logarithmic transfor-
mation. We continue our analysis of these data in the next section.
6.3 Types of Seasonal Variation 297
TABLE 6.4 Monthly Hotel Room Averages for 14 Years
y, t y, t y, t y, y, y, y,
1 501 25 555 49 585 73 645 97 665 121 723 145 748
2 488 26 523 50 553 74 593 98 626 122 655 146 731
3 504 27 532 51 576 75 617 99 649 123 658 147 748
4 578 28 623 52 665 76 686 100 740 124 761 148 827
5 545 29 598 53 656 77 679 101 729 125 768 149 788
6 632 30 683 54 720 78 773 102 324 126 885 150 937
7 728 31 774 55 826 79 906 103 937 127 1067 151 1076
8 725 32 780 56 838 80 934 104 994 128 1038 152 1125
9 585 33 609 57 652 81 713 105 781 129 812 153 840
10 542 34 604 58 661 82 710 106 759 130 790 154 864
II 480 35 531 59 584 83 600 107 643 131 692 155 717
12 530 36 592 60 644 84 676 108 728 132 782 156 813
13 518 37 578 61 623 85 645 109 691 133 758 157 811
14 489 38 543 62 553 86 602 110 649 134 709 158 732
15 528 39 565 63 599 87 601 111 656 135 715 159 745
16 599 40 648 64 657 88 709 112 735 136 788 160 844
17 572 41 615 65 680 89 706 113 748 137 794 161 833
18 659 42 697 66 759 90 817 114 837 138 893 162 935
19 739 43 785 67 878 91 930 115 995 139 1046 163 IUO
20 758 44 830 68 881 92 983 116 1040 140 1075 164 1124
21 602 45 645 69 705 93 745 117 809 141 812 165 868
22 587 46 643 70 684 94 735 118 793 142 822 166 860
23 497 47 551 71 577 95 620 119 692 143 714 167 762
24 558 48 606 72 656 96 698 120 763 144 802 168 877
FIGURE 6.15
A
JMP IN plot of
monthly hotel
room averages for
H: ,,\d!!A
14 years
i V\ AJ\J1V IV 'V
0:::
500
' ;
0 50 100 150
Time
FIGURE 6.16
33
A
JMP IN plot of
-5'31 square roots of
room averages 1i 29
'!;27
!!i",

"'23
21
0 50 100 150
Time
298 Chapter 6 Time Series Regression
FIGURE 6.17
JMP IN plot of
quartic roots of
room averages
FIGURE 6.18
JMP IN plot of
natural logarithms
of room averages
6.4
S8
r
------------,--,,--,,--,
:>.5.6
13
11 5,4
'" 5.2
"
1i 5
o
4.8

o 50 100 150
Time
7.1-,-----------___
>-6,9
13


26.3

o 50 100 150
Time
MODELING SEASONAL VARIATION
BY USING DUMMY VARIABLES AND
TRIGONOMETRIC FUNCTIONS
When analyzing a time series that exhibits constant seasonal variation, we often use
a model of the following fonn,
where
y/ = the observed value of the time series in time period t
TR, = the trend in time period t
SN, = the seasonal factor in time period t
E/ = the error term (irregular factor) in time period t
6.4 Modeling Seasonal Variation by Using Dummy Variables and Trigonometric Functions 299
This model says that the time series YI can be represented by an average level (denoted
Ill) that changes over time according to the equation
III = TRt + SNI
combined with random fluctuations (represented by the error tenn 1';1) that cause the
observations to deviate from the average level. We assume that the error tenn 101
isfies the usual regression assumptions-constant variance, independence, and
mality. Notice that tIus model implies that the magnitude of the seasonal swing is
independent of the trend (constant seasonal variation). Furthennore, if trl and snl
denote estimates of TR, and SN/ respectively, then this model gives an estimate of YI
that is equal to
One way to model seasonal patterns is to employ dummy variables. Assuming
that there are L seasons (months, quarters, etc.) per year, we express the seasonal
factor SN
I
as follows:
The seasonal factor expressed using dummy variables is
SN
f
= + + ... + J3s(L_l)xs(L_I).f
where xsI.
I
, Xs2,I" , Xf(L-l).1 are dummy variables that are defined as follows:
{
I
x -
s2,/ - 0
if time period t is season 1
otherwise
if time period t is season 2
otherwise
if time period t is season L - 1
otherwise
When L = 12, we have monthly data, and we will simplify the notation for the
dummy variables by using MI for x
s
I"M
2
for X02I ' and Mil for Xliii' WhenL = 4,
we have quarterly data, and we will the' notation for the variables by
using QI for Xd,t> Q2 for x
s
2.1' and Q3 for x
s
3,1' For example, if L = 12 and the trend is
linear, we have
Y
I
= TR, + SN, + Ef
= 130 + J3
l
t + J32M, + 13
3
M2 + .. , + J312
Mu + /

Potrebbero piacerti anche