Sample autocorrelation
autocorr(
plots the sample autocorrelation function (ACF) of the univariate, stochastic time series y
)y
with confidence bounds.
autocorr(
uses additional options specified by one or more name-value pair arguments. For example, y
,Name,Value
)autocorr(y,'NumLags',10,'NumSTD',2)
plots the sample ACF of y
for 10
lags and displays confidence bounds consisting of 2
standard errors.
returns the sample ACF of acf
= autocorr(___)y
using any of the input arguments in the previous syntaxes.
autocorr(
plots on the axes specified by ax
,___)ax
instead
of the current axes (gca
). ax
can precede any of the input
argument combinations in the previous syntaxes.
To plot the ACF without confidence bounds, set 'NumSTD',0
.
If y
is a fully observed series (that is, it does not contain any NaN
values), then autocorr
uses a Fourier transform to compute the ACF in the frequency domain, then converts back to the time domain using an inverse Fourier transform.
If y
is not fully observed (that is, it contains at least one NaN
value), autocorr
computes the ACF at lag k in the time domain, and includes in the sample average only those terms for which the cross product ytyt+k exists. Consequently, the effective sample size is a random variable.
autocorr
plots the ACF when you do not request any output or when you request the fourth output.
[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.