• Descriptive
    • Moments
    • Concentration
    • Central Tendency
    • Variability
    • Stem-and-Leaf Plot
    • Histogram & Frequency Table
    • Data Quality Forensics
    • Conditional EDA
    • Quantiles
    • Kernel Density Estimation
    • Normal QQ Plot
    • Bootstrap Plot

    • Multivariate Descriptive Statistics
  • Distributions
    • Binomial Probabilities
    • Geometric Probabilities
    • Negative Binomial Probabilities
    • Hypergeometric Probabilities
    • Multinomial Probabilities
    • Poisson Probabilities

    • Exponential
    • Gamma
    • Erlang
    • Weibull
    • Rayleigh
    • Lognormal
    • Pareto
    • Inverse Gamma

    • Beta
    • Power
    • Beta Prime (Inv. Beta)
    • Triangular

    • Normal (area)
    • Logistic
    • Laplace
    • Cauchy (standard)
    • Cauchy (location-scale)
    • Gumbel

    • Normal RNG
    • ML Fitting
    • Tukey Lambda PPCC
    • Box-Cox Normality Plot
    • Sample Correlation r

    • Empirical Tests
  • Hypotheses
    • Theoretical Aspects of Hypothesis Testing
    • Bayesian Inference
    • Minimum Sample Size

    • Empirical Tests
    • Multivariate (pair-wise) Testing
  • Models
    • Manual Model Building
  • Time Series
    • Time Series Plot
    • Decomposition
    • Exponential Smoothing

    • Blocked Bootstrap Plot
    • Mean Plot
    • (P)ACF
    • VRM
    • Standard Deviation-Mean Plot
    • Spectral Analysis
    • ARIMA

    • Cross Correlation Function
    • Granger Causality
  1. Descriptive Statistics & Exploratory Data Analysis
  2. 84  (Partial) Autocorrelation Function
  • Preface
  • Getting Started
    • 1  Introduction
    • 2  Why Do We Need Innovative Technology?
    • 3  Basic Definitions
    • 4  The Big Picture: Why We Analyze Data
  • Introduction to Probability
    • 5  Definitions of Probability
    • 6  Jeffreys’ axiom system
    • 7  Bayes’ Theorem
    • 8  Sensitivity and Specificity
    • 9  Naive Bayes Classifier
    • 10  Law of Large Numbers

    • 11  Problems
  • Probability Distributions
    • 12  Bernoulli Distribution
    • 13  Binomial Distribution
    • 14  Geometric Distribution
    • 15  Negative Binomial Distribution
    • 16  Hypergeometric Distribution
    • 17  Multinomial Distribution
    • 18  Poisson Distribution

    • 19  Uniform Distribution (Rectangular Distribution)
    • 20  Normal Distribution (Gaussian Distribution)
    • 21  Gaussian Naive Bayes Classifier
    • 22  Chi Distribution
    • 23  Chi-squared Distribution (1 parameter)
    • 24  Chi-squared Distribution (2 parameters)
    • 25  Student t-Distribution
    • 26  Fisher F-Distribution
    • 27  Exponential Distribution
    • 28  Lognormal Distribution
    • 29  Gamma Distribution
    • 30  Beta Distribution
    • 31  Weibull Distribution
    • 32  Pareto Distribution
    • 33  Inverse Gamma Distribution
    • 34  Rayleigh Distribution
    • 35  Erlang Distribution
    • 36  Logistic Distribution
    • 37  Laplace Distribution
    • 38  Gumbel Distribution
    • 39  Cauchy Distribution
    • 40  Triangular Distribution
    • 41  Power Distribution
    • 42  Beta Prime Distribution
    • 43  Sample Correlation Distribution

    • 44  Problems
  • Descriptive Statistics & Exploratory Data Analysis
    • 45  Types of Data
    • 46  Datasheets

    • 47  Frequency Plot (Bar Plot)
    • 48  Frequency Table
    • 49  Contingency Table
    • 50  Binomial Classification Metrics
    • 51  Confusion Matrix
    • 52  ROC Analysis

    • 53  Stem-and-Leaf Plot
    • 54  Histogram
    • 55  Data Quality Forensics
    • 56  Quantiles
    • 57  Central Tendency
    • 58  Variability
    • 59  Skewness & Kurtosis
    • 60  Concentration
    • 61  Notched Boxplot
    • 62  Scatterplot
    • 63  Pearson Correlation
    • 64  Rank Correlation
    • 65  Partial Pearson Correlation
    • 66  Simple Linear Regression
    • 67  Moments
    • 68  Quantile-Quantile Plot (QQ Plot)
    • 69  Normal Probability Plot
    • 70  Probability Plot Correlation Coefficient Plot (PPCC Plot)
    • 71  Box-Cox Normality Plot
    • 72  Kernel Density Estimation
    • 73  Bivariate Kernel Density Plot
    • 74  Conditional EDA: Panel Diagnostics
    • 75  Bootstrap Plot (Central Tendency)
    • 76  Survey Scores Rank Order Comparison
    • 77  Cronbach Alpha

    • 78  Equi-distant Time Series
    • 79  Time Series Plot (Run Sequence Plot)
    • 80  Mean Plot
    • 81  Blocked Bootstrap Plot (Central Tendency)
    • 82  Standard Deviation-Mean Plot
    • 83  Variance Reduction Matrix
    • 84  (Partial) Autocorrelation Function
    • 85  Periodogram & Cumulative Periodogram

    • 86  Problems
  • Hypothesis Testing
    • 87  Normal Distributions revisited
    • 88  The Population
    • 89  The Sample
    • 90  The One-Sided Hypothesis Test
    • 91  The Two-Sided Hypothesis Test
    • 92  When to use a one-sided or two-sided test?
    • 93  What if \(\sigma\) is unknown?
    • 94  The Central Limit Theorem (revisited)
    • 95  Statistical Test of the Population Mean with known Variance
    • 96  Statistical Test of the Population Mean with unknown Variance
    • 97  Statistical Test of the Variance
    • 98  Statistical Test of the Population Proportion
    • 99  Statistical Test of the Standard Deviation \(\sigma\)
    • 100  Statistical Test of the difference between Means -- Independent/Unpaired Samples
    • 101  Statistical Test of the difference between Means -- Dependent/Paired Samples
    • 102  Statistical Test of the difference between Variances -- Independent/Unpaired Samples

    • 103  Hypothesis Testing for Research Purposes
    • 104  Decision Thresholds, Alpha, and Confidence Levels
    • 105  Bayesian Inference for Decision-Making
    • 106  One Sample t-Test
    • 107  Skewness & Kurtosis Tests
    • 108  Paired Two Sample t-Test
    • 109  Wilcoxon Signed-Rank Test
    • 110  Unpaired Two Sample t-Test
    • 111  Unpaired Two Sample Welch Test
    • 112  Two One-Sided Tests (TOST) for Equivalence
    • 113  Mann-Whitney U test (Wilcoxon Rank-Sum Test)
    • 114  Bayesian Two Sample Test
    • 115  Median Test based on Notched Boxplots
    • 116  Chi-Squared Tests for Count Data
    • 117  Kolmogorov-Smirnov Test
    • 118  One Way Analysis of Variance (1-way ANOVA)
    • 119  Kruskal-Wallis Test
    • 120  Two Way Analysis of Variance (2-way ANOVA)
    • 121  Repeated Measures ANOVA
    • 122  Friedman Test
    • 123  Testing Correlations
    • 124  A Note on Causality

    • 125  Problems
  • Regression Models
    • 126  Simple Linear Regression Model (SLRM)
    • 127  Multiple Linear Regression Model (MLRM)
    • 128  Logistic Regression
    • 129  Generalized Linear Models
    • 130  Multinomial and Ordinal Logistic Regression
    • 131  Cox Proportional Hazards Regression
    • 132  Conditional Inference Trees
    • 133  Leaf Diagnostics for Conditional Inference Trees
    • 134  Hypothesis Testing with Linear Regression Models (from a Practical Point of View)

    • 135  Problems
  • Introduction to Time Series Analysis
    • 136  Case: the Market of Health and Personal Care Products
    • 137  Decomposition of Time Series
    • 138  Ad hoc Forecasting of Time Series
  • Box-Jenkins Analysis
    • 139  Introduction to Box-Jenkins Analysis
    • 140  Theoretical Concepts
    • 141  Stationarity
    • 142  Identifying ARMA parameters
    • 143  Estimating ARMA Parameters and Residual Diagnostics
    • 144  Forecasting with ARIMA models
    • 145  Intervention Analysis
    • 146  Cross-Correlation Function
    • 147  Transfer Function Noise Models
    • 148  General-to-Specific Modeling
  • References
  • Appendices
    • Appendices
    • A  Method Selection Guide
    • B  Presentations and Teaching Materials
    • C  R Language Concepts for Statistical Computing
    • D  Matrix Algebra
    • E  Standard Normal Table (Gaussian Table)
    • F  Critical values of Student’s \(t\) distribution with \(\nu\) degrees of freedom
    • G  Upper-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom
    • H  Lower-tail critical values of the \(\chi^2\)-distribution with \(\nu\) degrees of freedom

Table of contents

  • 84.1 Definition
    • 84.1.1 Horizontal axis
    • 84.1.2 Vertical axis
  • 84.2 R Module
    • 84.2.1 Public website
    • 84.2.2 RFC
  • 84.3 Purpose
  • 84.4 Pros & Cons
    • 84.4.1 Pros
    • 84.4.2 Cons
  • 84.5 Example
  • 84.6 Task
DRAFT This draft is under development — DO NOT CITE OR SHARE.
  1. Descriptive Statistics & Exploratory Data Analysis
  2. 84  (Partial) Autocorrelation Function

84  (Partial) Autocorrelation Function

84.1 Definition

The Autocorrelation Function (ACF) of a time series \(Y_t\) relates sequential correlations (on the y-axis) \(\rho_k = \rho(Y_t, Y_{t-k})\) for \(k = 1, 2, …, K\) to the time lag \(k\) (on the x-axis). Often this is presented in graphical form because it allows to quickly detect patterns that are typical of the dynamical properties of the underlying time series. Note that the time lag \(k\) is sometimes called the “order” of autocorrelation.

The sample autocorrelations are computed by the formula

\[ \hat{\rho}_k = \frac{\overset{T}{\underset{t=k+1}\sum} \left( (Y_t - \bar{Y})(Y_{t-k} - \bar{Y}) \right) }{\overset{T}{\underset{t=1}\sum} \left(Y_t - \bar{Y} \right)^2} \]

with

\[ \bar{Y} = \frac{1}{T} \overset{T}{\underset{t=1}\sum} Y_t \]

The 95% Confidence Intervals (of individual autocorrelation coefficients) are displayed as two horizontal lines, based on the approximated standard deviation \(\sigma_{\rho_k} \simeq \tfrac{1}{\sqrt{T}}\) (Bartlett 1946). These bands assume a white-noise null hypothesis (approximately i.i.d. observations/residuals); if that assumption is violated, they are only approximate and may be anti-conservative.

The Partial Autocorrelation Function (PACF) at lag \(k\) is the correlation between \(Y_t\) and \(Y_{t-k}\) after removing the linear effects of the intermediate lags \(Y_{t-1},\ldots,Y_{t-k+1}\). In practice, PACF isolates the direct lag-\(k\) relationship that is not explained by shorter lags.

84.1.1 Horizontal axis

The horizontal axis displays the time lag \(k\).

84.1.2 Vertical axis

The vertical axis represents the autocorrelation coefficients \(\hat{\rho}_k\).

84.2 R Module

84.2.1 Public website

The (Partial) Autocorrelation Function is available on the public website:

  • https://compute.wessa.net/rwasp_autocorrelation.wasp

84.2.2 RFC

The (Partial) Autocorrelation Function is also available in RFC (when using the default profile) under the “Time Series / (P)ACF” menu item.

To compute the (Partial) Autocorrelation Function on your local machine, the following script can be used in the R console:

par(mar = c(4, 4, 2, 1))
x <- 100 + cumsum(rnorm(150))
summary(x)
par1 = 20 #number of time lags
par2 = 1 #Box-Cox transformation parameter
par3 = 0 #degree of non-seasonal differencing
par4 = 0 #degree of seasonal differencing
par5 = 12 #seasonality
par6 = 'White Noise' #type of confidence interval
par7 = 0.95 #confidence interval
par8 = ''
if (par1 == 'Default') {
  par1 = 10*log10(length(x))
} else {
  par1 <- as.numeric(par1)
}
if (par6 == 'White Noise') par6 <- 'white' else par6 <- 'ma'
if (par8 != '') par8 <- as.numeric(par8)
ox <- x
if (par8 == '') {
  if (par2 == 0) {
    x <- log(x)
  } else {
    x <- (x ^ par2 - 1) / par2
  }
} else {
  x <- log(x,base=par8)
}
if (par3 > 0) x <- diff(x,lag=1,difference=par3)
if (par4 > 0) x <- diff(x,lag=par5,difference=par4)
op <- par(mfrow=c(2,1))
plot(ox,type='l',main='Original Time Series',xlab='time',ylab='value')
if (par8=='') {
  mytitle <- paste('Working Time Series (lambda=',par2,', d=',par3,', D=',par4,')',sep='')
  mysub <- paste('(lambda=',par2,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='')
} else {
  mytitle <- paste('Working Time Series (base=',par8,', d=',par3,', D=',par4,')',sep='')
  mysub <- paste('(base=',par8,', d=',par3,', D=',par4,', CI=', par7, ', CI type=',par6,')',sep='')
}
plot(x,type='l', main=mytitle,xlab='time',ylab='value')

par(op)
racf <- acf(x, par1, main='Autocorrelation', xlab='time lag', ylab='ACF', ci.type=par6, ci=par7, sub=mysub)

rpacf <- pacf(x,par1,main='Partial Autocorrelation',xlab='lags',ylab='PACF',sub=mysub)

df = data.frame(k = 0:par1, ACF = c(racf$acf), PACF = c(NA, rpacf$acf))
print(df)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  88.70   92.04   95.34   95.64   98.98  103.48 
    k       ACF         PACF
1   0 1.0000000           NA
2   1 0.9641327  0.964132727
3   2 0.9377101  0.115804737
4   3 0.9006417 -0.149490338
5   4 0.8784754  0.163957039
6   5 0.8576102  0.070461330
7   6 0.8401357 -0.003893119
8   7 0.8197559 -0.022804006
9   8 0.8062368  0.101826350
10  9 0.7928397  0.035465183
11 10 0.7807072 -0.018532206
12 11 0.7662368 -0.009210677
13 12 0.7435307 -0.116616255
14 13 0.7183888 -0.061563924
15 14 0.6949425  0.025299960
16 15 0.6842709  0.164511439
17 16 0.6721748 -0.027633548
18 17 0.6608073 -0.048887702
19 18 0.6406221 -0.071009279
20 19 0.6190338 -0.057990241
21 20 0.5911225 -0.112282534

To compute the (Partial) Autocorrelation Function, the R code uses the standard acf and pacf functions to compute the analysis.

84.3 Purpose

In practice the ACF can be used to:

  • describe/summarize autocorrelation at various orders
  • identify non-seasonal and seasonal trends
  • identify various types of typical patterns that correspond to well-known forecasting models
  • check the independence assumption of the residuals of regression and forecasting models

84.4 Pros & Cons

84.4.1 Pros

The (Partial) Autocorrelation Function has the following advantages:

  • It is relatively easy to interpret and provide a lot of information about the serial correlation of a time series.
  • It can be computed with many software packages (even though one should be careful when using spreadsheets because they do not take empty cells that occur in lagged time series into account properly).
  • The combination of Partial and (ordinary) Autocorrelation Functions allows one to identify how the time series model should be specified (Box and Jenkins 1970).
  • It allows one to check an important assumption of residuals (prediction errors).

84.4.2 Cons

The (Partial) Autocorrelation Function has the following disadvantages:

  • It is sensitive to outliers.
  • The confidence intervals are not always computed correctly in statistical software. There are (at least) two types of confidence intervals: one for testing whether residuals contain autocorrelation1 and another which should be used to identify the autocorrelation structure of the time series model2.

84.5 Example

Let us consider the Airline Data and apply the ACF analysis. In a first stage we compute the ACF without any differencing, i.e. \(d = D = 0\) (these parameters were introduced in Section 83.1). The analysis shows the ACF for the original time series and exhibits a pattern which is typical for time series with a non-seasonal trend and strong seasonality:

  • The coefficients of the ACF are positive and slowly decreasing.
  • The seasonal coefficients, i.e. \(\rho_{12}, \rho_{24}, \rho_{36}, ...\) are positive and slowly decreasing too.
Interactive Shiny app (click to load).
Open in new tab

In the next step we set \(d = 1\) in order to apply non-seasonal differencing (the other parameter is not changed, \(D = 0\)). When we recompute the ACF (with \(d=1\)) then an entirely different pattern is observed, as is shown in the R module where the long-run trend pattern has disappeared. Only the seasonal Autocorrelation coefficients are still clearly positive and slowly decreasing, indicating the presence of a strong, seasonal pattern.

Finally we set \(d = D = 1\) to apply ordinary and seasonal differencing before recomputing the ACF. The R module shows that the combined differencing procedures eliminate the trend and the seasonal pattern. We can see this in the ACF because it does not exhibit the typical seasonality pattern anymore.

In later chapters, this information will be used to build a practical forecasting model for the Airline time series.

84.6 Task

Based on the ACF, examine the monthly time series of Divorces and determine whether or not there is a long-run trend and seasonality.

Bartlett, M. S. 1946. “On the Theoretical Specification and Sampling Properties of Autocorrelated Time-Series.” Journal of the Royal Statistical Society. Series B (Methodological) 8 (1): 27–41.
Box, George E. P., and Gwilym M. Jenkins. 1970. Time Series Analysis: Forecasting and Control. San Francisco: Holden-Day.

  1. In this case you should set the field “CI type” equal to “White Noise” in the R module.↩︎

  2. This is achieved by setting the field “CI type” to the value “MA”↩︎

83  Variance Reduction Matrix
85  Periodogram & Cumulative Periodogram

© 2026 Patrick Wessa. Provided as-is, without warranty.

Feedback: e-mail | Anonymous contributions: click to copy (Sats) | click to copy (XMR)

Cookie Preferences