parcorr

Sample partial autocorrelation

Syntax

  • pacf = parcorr(y) example
  • pacf = parcorr(y,numLags) example
  • pacf = parcorr(y,numLags,numAR,numSTD) example
  • [pacf,lags,bounds] = parcorr(___) example

Description

example

parcorr(y) plots the sample partial autocorrelation function (PACF) of the univariate, stochastic time series y with confidence bounds.

example

parcorr(y,numLags) plots the PACF, where numLags indicates the number of lags in the sample PACF.

example

parcorr(y,numLags,numAR,numSTD) plots the PACF, where numAR specifies the number of lags beyond which the theoretical PACF is effectively 0, and numSTD specifies the number of standard deviations of the sample PACF estimation error.

example

pacf = parcorr(y) returns the sample partial autocorrelation function (PACF) of the univariate, stochastic time series y.

example

pacf = parcorr(y,numLags) returns the PACF, where numLags specifies the number of lags in the sample PACF.

example

pacf = parcorr(y,numLags,numAR,numSTD) returns the PACF, where numAR specifies the number of lags beyond which the theoretical PACF is effectively 0, and numSTD specifies the number of standard deviations of the sample PACF estimation error.

example

[pacf,lags,bounds] = parcorr(___) additionally returns the lags (lags) corresponding to the PACF and the approximate upper and lower confidence bounds (bounds), using any of the input arguments in the previous syntaxes.

Examples

expand all

Plot the Partial Autocorrelation Function of a Time Series

Specify the AR(2) model:

$$y_t = 0.6y_{t-1} - 0.5y_{t-2} + \varepsilon_t,$$

where $\varepsilon_t$ is Gaussian with mean 0 and variance 1.

rng(1); % For reproducibility
Mdl = arima('AR',{0.6 -0.5},'Constant',0,'Variance',1)
Mdl = 

    ARIMA(2,0,0) Model:
    --------------------
    Distribution: Name = 'Gaussian'
               P: 2
               D: 0
               Q: 0
        Constant: 0
              AR: {0.6 -0.5} at Lags [1 2]
             SAR: {}
              MA: {}
             SMA: {}
        Variance: 1

Simulate 1000 observarions from Mdl.

y = simulate(Mdl,1000);

Compute the PACF.

[partialACF,lags,bounds] = parcorr(y,[],2);
bounds
bounds =

    0.0633
   -0.0633

bounds displays (-0.0633, 0.0633), which are the upper and lower confidence bounds.

Plot the PACF.

parcorr(y)

The PACF cuts off after the second lag. This behavior indicates an AR(2) process.

Specify More Lags for the PACF Plot

Specify the multiplicative seasonal ARMA $(2,0,1)\times(3,0,0)_{12}$ model:

$$(1-0.75L-0.15L^2)(1-0.9L^{12}+0.75L^{24}-0.5L^{36})y_t = 2+\varepsilon_t-0.5\varepsilon_{t-1},$$

where $\varepsilon_t$ is Gaussian with mean 0 and variance 1.

Mdl = arima('AR',{0.75,0.15},'SAR',{0.9,-0.75,0.5},...
    'SARLags',[12,24,36],'MA',-0.5,'Constant',2,...
    'Variance',1);

Simulate data from Mdl.

rng(1);
y = simulate(Mdl,1000);

Plot the default partial autocorrelation function (PACF).

figure
parcorr(y)

The default correlogram does not display the dependence structure for higher lags.

Plot the PACF for 40 lags.

figure
parcorr(y,40)

The correlogram shows the larger correlations at lags 12, 24, and 36.

Input Arguments

expand all

y — Observed univariate time seriesvector

Observed univariate time series for which the software computes or plots the PACF, specified as a vector. The last element of y contains the most recent observation.

Data Types: double

numLags — Number of lagsmin(20,length(y)-1) (default) | positive integer

Number of lags of the PACF that the software returns or plots, specified as a positive integer.

For example, parcorr(y,10) plots the PACF for lags 0 through 10.

Data Types: double

numAR — AR order0 (default) | nonnegative integer

AR order that specifies the number of lags beyond which the theoretical PACF is effectively 0, specified as a nonnegative integer.

  • numAR must be less than numLags.

  • Specify numAR to assess whether the PACF is effectively 0 beyond lag numAR. Specifically, if y is an AR(numAR) process, then:

    • The PACF coefficient estimates at lags greater than numAR are approximately mean 0, independently distributed Gaussian variates.

    • The standard errors of the estimated PACF coefficients for lags greater than numAR of a length T series are 1/T [1].

Example: [~,~,bounds] = parcorr(y,[],5)

Data Types: double

numSTD — Number of standard deviations2 (default) | positive scalar

Number of standard deviations for the sample PACF estimation error assuming that y is an AR(numAR), specified as a positive scalar. For example, parcorr(y,[],[],1.5) plots the PACF with estimation error bounds 1.5 standard deviations away from 0.

If the software estimates the PACF coefficient at of lag numAR using T observations, then the confidence bounds are:

±numSTDT.

The default (numSTD = 2) corresponds to approximate 95% confidence bounds.

Data Types: double

Output Arguments

expand all

pacf — Sample PACFvector

Sample PACF of the univariate time series y, returned as a vector of length numLags + 1.

The elements of pacf correspond to lags 0, 1, 2,... numLags.

The first element, which corresponds to lag 0, is unity (i.e., pacf(1) = 1). This corresponds to the coefficient of y regressed onto itself.

lags — Sample PACF lagsvector

Sample PACF lags, returned as a vector. Specifically, lags = 0:numLags.

bounds — Approximate confidence boundsvector

Approximate confidence bounds of the PACF assuming y is an AR(numAR) process, returned as a two-element vector. bounds is approximate for lags > numAR.

More About

expand all

Partial Autocorrelation Function

Measures the correlation between yt and yt + k after adjusting for the linear effects of yt + 1,...,yt + k – 1.

The estimation of the PACF involves solving the Yule-Walker equations with respect to the autocorrelations. However, the software estimates the PACF by fitting successive autoregressive models of orders 1, 2,... using ordinary least squares. For details, see [1], Chapter 3.

Tips

To plot the ACF without confidence bounds, set numSTD to 0.

References

[1] Box, G. E. P., G. M. Jenkins, and G. C. Reinsel. Time Series Analysis: Forecasting and Control. 3rd ed. Englewood Cliffs, NJ: Prentice Hall, 1994.

[2] Hamilton, J. D. Time Series Analysis. Princeton, NJ: Princeton University Press, 1994.

See Also

| |

Was this topic helpful?