Library: | times |
See also: | acf pacf pacfplot fft invfft boxlj |
Quantlet: | boxpi | |
Description: | computes the autocorrelation function (acf) and the Box-Pierce statistics for autocorrelation in a time series. Additionally, the p-values for the statistic are computed. |
Usage: | qbp = boxpi(x {, maxlag}) | |
Input: | ||
x | T x 1 vector, time series | |
maxlag | (optional) integer, maximum lag for which the above described values are calculated, default is maxlag = 30 | |
Output: | ||
qbp | maxlag x 3 matrix, gives the autocorrelation function in the first column, the Box-Pierce statistics in the second and the p-values for the statistic in the third column (see the notes). |
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 qbp = boxpi(return,6) ; calculates the acf, lb-stat and p-values qbp
Generates a matrix with the autocorrelation function, the Box-Pierce statistics and the corresponding p-values for the returns of the German stock index DAX Contents of qbp [1,] 0.036135 0.34081 0.55935 [2,] 0.033234 0.62907 0.73012 [3,] -0.030004 0.86403 0.83409 [4,] 0.013575 0.91213 0.92281 [5,] -0.069839 2.1852 0.82297 [6,] -0.0488 2.8067 0.83268