# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# parcorr

Sample partial autocorrelation

## Syntax

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

## 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

collapse all

Specify the AR(2) model:

where 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 the multiplicative seasonal ARMA model:

where 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

collapse all

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`

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`

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/\sqrt{T}$ [1].

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

Data Types: `double`

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:

`$±\frac{numSTD}{\sqrt{T}}.$`

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

Data Types: `double`

## Output Arguments

collapse all

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.

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

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`.

collapse 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.