Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: times
See also: acfplot pacf pacfplot fft invfft

Quantlet: acf
Description: computes the (sample) autocorrelation function for the time series x. The output vector starts with the autocorrelation r_0 at lag length 0 (and thus is equal to 1). The next entries are r_1, r_2 ... r_k.

Reference(s):

Usage: y = acf(x)
Input:
x T x 1 vector of observed time series
Output:
y (T-1) x 1 vector of sample autocorrelations

Note:

Example:
library("times")         ; loads the quantlets from times library
dax    = read("dax.dat") ; monthly DAX 1979:1-2000:10
return = tdiff(log(dax)) ; generates the monthly return
ac     = acf(return)
acsqr  = acf(return^2)
ac[2:13]~acsqr[2:13]     ; output matrix

Result:
Contents of _tmp
[ 1,]  0.036135  0.19351
[ 2,]  0.033234  0.0063057
[ 3,] -0.030004  0.063934
[ 4,]  0.013575  0.065805
[ 5,] -0.069839  0.047433
[ 6,] -0.0488   -0.034815
[ 7,] -0.019639 -0.041839
[ 8,] -0.016576  0.058419
[ 9,] -0.038026  0.050764
[10,]  0.13247   0.060905
[11,]  0.039088 -0.020016
[12,]  0.017175 -0.052257
The sample autocorrelations with maximal lag length k = 12. We have
T = 261 observations and thus the confidence bands are
+/- 0.12. r_10 of the DAX returns and r_1 of the squared
DAX returns lie outside these bands.



Author: C. Hafner, W. Haerdle, R. Schulz, 20010419 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006