Autocorrelation Concepts
Chapter 2: Lesson 2
Learning Outcomes
Define key terms in time series analysis
- Define the ensemble of a time series
- Define the expected value (or mean function) of a time series model
- Define the sample estimate of the population mean of a time series
- Define the variance function of a time series model
- State the constant variance estimator for a time series model
- Explain the stationarity assumption
- Explain the stationary variance assumption
- Define lag
- Define autocorrelation
- Define the second-order stationary time series
- Explain the autocovariance function in Equation (2.11)
- Explain the lag k autocorrelation function in Equation (2.12)
- Define the autocovariance function, acvf
- Define the sample autocorrelation function, acf
Calculate sample estimates of autocovariance and autocorrelation functions from time series data
- Define the sample autocovariance function, c_k
- Define the sample autocorrelation function, r_k
Preparation
- Read Sections 2.2.5
Learning Journal Exchange (10 min)
- Review another student’s journal
- What would you add to your learning journal after reading your partner’s?
- What would you recommend your partner add to their learning journal?
- Sign the Learning Journal review sheet for your peer
Hands-on Exercise – Exploring Sample Autocorrelation (40 min)
Autocovariance and Autocorrelation
We will use the following data to explore the concepts of autovariance and autocorrelation.
t | |
---|---|
1 | 4.4 |
2 | 4.2 |
3 | 4.2 |
4 | 4.0 |
5 | 4.4 |
6 | 4.7 |
7 | 4.9 |
8 | 5.3 |
9 | 5.4 |
10 | 5.5 |
You can use this R command to read in the observations.
x <- c( 4.4, 4.2, 4.2, 4, 4.4, 4.7, 4.9, 5.3, 5.4, 5.5 )
We will use the sample mean of these data repeatedly. The value of
We will be finding the autocovariance and correlation of a time series with itself. First, we start with a lag of 1. With a lag of 1 the corresponding values of the time series that are being compared are shifted by one time unit. Then, we will consider any integer lag: lag
Lag Sample Autocovariance Function (acvf),
The lag
We denote the lag by the letter
Lag Sample Autocovariance Function,
We will now find the autocovariance between the values in a time series (
t | ||||||
---|---|---|---|---|---|---|
1 | 4.4 | 4.2 | -0.3 | 0.09 | -0.5 | 0.15 |
2 | 4.2 | 4.2 | -0.5 | 0.25 | -0.5 | 0.25 |
3 | 4.2 | 4 | -0.5 | 0.25 | -0.7 | 0.35 |
4 | 4 | 4.4 | -0.7 | 0.49 | -0.3 | 0.21 |
5 | 4.4 | 4.7 | -0.3 | 0.09 | 0 | 0 |
6 | 4.7 | 4.9 | 0 | 0 | 0.2 | 0 |
7 | 4.9 | 5.3 | 0.2 | 0.04 | 0.6 | 0.12 |
8 | 5.3 | 5.4 | 0.6 | 0.36 | 0.7 | 0.42 |
9 | 5.4 | 5.5 | 0.7 | 0.49 | 0.8 | 0.56 |
10 | 5.5 | — | 0.8 | 0.64 | — | — |
sum | 47 | 42.6 | 0 | 2.7 | 0.3 | 2.06 |
The scatterplot below illustrates the relationship between the observed data (
In this example, the second variable is
This is the (auto)covariance of
Lag Sample Autocorrelation Function (acf),
The sample autocorrelation function, acf, denoted
Note that
Lag Sample Autocorrelation Function,
We can compute the lag 1 autocorrelation or the autocorrelation of
We use
- What does the lag 1 autocorrelation,
, measure?
Lag
t | ||||||
---|---|---|---|---|---|---|
1 | 4.4 | 4.2 | -0.3 | 0.09 | -0.5 | 0.15 |
2 | 4.2 | 4 | -0.5 | 0.25 | -0.7 | 0.35 |
3 | 4.2 | 4.4 | -0.5 | 0.25 | -0.3 | 0.15 |
4 | 4 | |||||
5 | 4.4 | |||||
6 | 4.7 | |||||
7 | 4.9 | 5.4 | 0.2 | 0.04 | 0.7 | 0.14 |
8 | 5.3 | 5.5 | 0.6 | 0.36 | 0.8 | 0.48 |
9 | 5.4 | — | 0.7 | 0.49 | — | — |
10 | 5.5 | — | 0.8 | 0.64 | — | — |
sum | 47 |
The figure below illustrates the relationship between
Lag
t | ||||||
---|---|---|---|---|---|---|
1 | 4.4 | 4 | -0.3 | 0.09 | -0.7 | 0.21 |
2 | 4.2 | 4.4 | -0.5 | 0.25 | -0.3 | 0.15 |
3 | 4.2 | 4.7 | -0.5 | 0.25 | 0 | 0 |
4 | 4 | 4.9 | -0.7 | 0.49 | 0.2 | -0.14 |
5 | 4.4 | 5.3 | -0.3 | 0.09 | 0.6 | -0.18 |
6 | 4.7 | 5.4 | 0 | 0 | 0.7 | 0 |
7 | 4.9 | 5.5 | 0.2 | 0.04 | 0.8 | 0.16 |
8 | 5.3 | — | 0.6 | 0.36 | — | — |
9 | 5.4 | — | 0.7 | 0.49 | — | — |
10 | 5.5 | — | 0.8 | 0.64 | — | — |
sum | 47 | 34.2 | 0 | 2.7 | 1.3 | 0.2 |
The figure below illustrates the correlations between
Lag
t | ||||||
---|---|---|---|---|---|---|
1 | 4.4 | |||||
2 | 4.2 | |||||
3 | 4.2 | |||||
4 | 4 | |||||
5 | 4.4 | |||||
6 | 4.7 | |||||
7 | 4.9 | |||||
8 | 5.3 | |||||
9 | 5.4 | |||||
10 | 5.5 | |||||
sum | 47 |
The figure below illustrates the correlations between
Class Activity: Using R to compute the acvf and acf (5 min)
We will continue to use the following sample data.
x <- c( 4.4, 4.2, 4.2, 4, 4.4, 4.7, 4.9, 5.3, 5.4, 5.5 )
df <- data.frame(x = x)
acvf
This code gives the values of the acvf.
acf(df$x, plot=FALSE, type = "covariance")
Autocovariances of series 'df$x', by lag
0 1 2 3 4 5 6 7 8 9
0.270 0.206 0.121 0.020 -0.064 -0.113 -0.127 -0.093 -0.061 -0.024
acf
We can obtain the acf by changing the argument for the paramter type
to "correlation"
.
acf(df$x, plot=FALSE, type = "correlation")
Autocorrelations of series 'df$x', by lag
0 1 2 3 4 5 6 7 8 9
1.000 0.763 0.448 0.074 -0.237 -0.419 -0.470 -0.344 -0.226 -0.089
Homework Preview (5 min)
- Review upcoming homework assignment
- Clarify questions