Professional Documents
Culture Documents
Chapter 4 - Correlation and Autocorrelation
Chapter 4 - Correlation and Autocorrelation
Correlation coefficient
1
9/21/2023
Autocorrelation
• Def1: Autocorrelation (tự tương quan) is a correlation of the values
of a variable with values of the same variable lagged one or more
periods back.
• Consequences of autocorrelation include inaccurate estimates of
Time (t) Residual Plot
variances and inaccurate predictions.
• Violates the regression 15
10
assumption that 5
Residuals
2
9/21/2023
Autocorrelation illustration
• Autocorrelation is the correlation between a variable
lagged one or more time periods and itself.
Data patterns, including components such as trend and
seasonality, can be studied using autocorrelations
• t won’t changed on Yt, Y(t-
1) and Y(t-2)
• Variables Y(t-1) and Y(t-2)
are actually the Y values
that have been lagged by
one and two time periods
• The values for March (or
March sales) = 125 on Yt,
= 130 on Y(t-1) (of Yt
February sales) ; and
January sales, = 123 on
Y(t-2)
5
Autocorrelation coefficient
• Formula for computing the lag k autocorrelation
coefficient (rk) between observations of Yt and of that
are k periods apart Autocorrelation is a
n systematic pattern in the
Y Y Y
t t k Y errors that can be either
attracting (positive) or
rk t k 1
n
k 0,1, 2, repelling (negative)
Y Y
2
t autocorrelation.
t 1
where
rk = the autocorrelation coefficient for a lag of k periods
𝑌 = the mean of the values of the series
Yt = the observation in time period t
Yt-k = the observation k time periods earlier or at time period t - k
3
9/21/2023
4
9/21/2023
• Partial Autocorrelation:
This is another metric used in time
series analysis.
It measures the correlation
between a variable and its lag
while controlling for the values
at all shorter lags.
It is helpful for identifying the true
order of an autoregressive
process (ARIMA model!) 9
10
5
9/21/2023
11
6
9/21/2023
Autocorrelation Model
Independent errors:
et does not depend on et-1 ( = 0)
Autocorrelated errors:
et depends on et-1 (r 0)
Autocorrelated Residuals
Common Rare
Positive Autocorrelation Negative Autocorrelation
20 20
15 15
10 10
Residual
5 5
Residual
0 0
-5 -5
-10 -10
-15 -15
-20 -20
Tim e Tim e
14
7
9/21/2023
the observation of
the error term (ut) is
a function of the
previous (lagged)
observation of the
error term (ut-1)
15
16
8
9/21/2023
First-order autocorrelation
• First-order autocorrelation refers to the correlation between a
time series and its own values lagged by one period.
If Yt represents the time series, first-order autocorrelation quantifies the
correlation between Yt and Yt-1
• Positive First-Order Autocorrelation
If the time series has a positive first-order autocorrelation, it means that if
a particular value is above the mean, then the next value is also likely to
be above the mean. Similarly, if a value is below the mean, the next value
is likely to be below the mean.
This often indicates a momentum or trend in the data.
• Negative First-Order Autocorrelation
This suggests that if a value is above the mean, the next value is likely to
be below the mean, and vice versa.
This can indicate a sort of "mean-reverting" oscillation.
• Near-Zero First-Order Autocorrelation
This indicates that consecutive values in the time series are essentially
independent of each other
17
9
9/21/2023
19
20
10
9/21/2023
21
400000
300000
Sales_1
200000
100000
0
1 8 16 24 32 40 48 56 64 72 80
Index
22
11
9/21/2023
1.0
0.8
0.6
0.4
Autocorrelation
0.2
0.0
-0.2
-0.4
-0.6
-0.8
-1.0
1 5 10 15 20 25 30 35 40 45 50 55 60
Lag
23
n
Durbin-Watson test statistic:
(e t e t 1 )2
d t 1
n
Assumed Model: et = r et-1 + ut
e
2
t
where ut is assumed non-autocorrelated t 1
24
12
9/21/2023
0 dL dU 2
25
26
13
9/21/2023
Durbin-Watson Test
0 dL dU 2 4-dU 4-dL 4
28
14
9/21/2023
140
100
Sum of Squared
Sales
80 y = 30.65 + 4.7038x
Difference of Residuals 3296.18 2
60 R = 0.8976
Sum of Squared
40
Residuals 3279.98
20
Durbin-Watson 0
Statistic 1.00494 0 5 10 15 20 25 30
Tim e
Example 3.2 (e t e t 1 )2
3296.18
d t 1
1.00494
page 69
n
3279.98
e
2
t
t 1
29
30
15