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

acf = autocorr(y,numLags,numMA,numSTD) returns
the ACF, where numMA specifies the number of
lags beyond which the theoretical ACF is effectively 0, and numSTD specifies
the number of standard deviations of the sample ACF estimation error.

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

[] tells the software to return the default number of lags (20). numMA = 2 indicates that the ACF is effectively 0 after the second lag. bounds displays (-0.0843, 0.0843), which are the upper and lower confidence bounds.

Plot the ACF.

autocorr(y)

The ACF cuts off after the second lag. This behavior indicataes an MA(2) process.

Although various estimates of the sample autocorrelation function exist, autocorr uses the form in Box, Jenkins, and Reinsel, 1994. In their estimate, they scale the correlation at each lag by the sample variance (var(y,1)) so that the autocorrelation at lag 0 is unity. However, certain applications require rescaling the normalized ACF by another factor.

Simulate 1000 observations from the standard Gaussian distribution.

rng(1); % For reproducibility
y = randn(1000, 1);

Compute the normalized and unnormalized sample ACF.

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

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

numMA must be less than numLags.

Specify numMA to assess whether
the ACF is effectively zero beyond lag numMA[1]. The software uses Bartlett's
approximation to estimate the large-lag standard error for lags that
are greater than numMA.

If numMA = 0, then the software
assumes that y is a length T Gaussian
white noise process. In this case, the standard error is approximately

Number of standard deviations for the sample ACF estimation
error assuming the theoretical ACF is 0 beyond lag numMA,
specified as a positive scalar. For example, autocorr(y,[],[],1.5) plots
the ACF with estimation error bounds 1.5 standard deviations away
from 0.

If numMA = 0 and y a lengthT Gaussian
process, then the confidence bounds are:

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