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

 Quantlet: boxlj Description: computes the autocorrelation function (acf) and the Box-Ljung statistics for autocorrelation in a time series. Additionally, the p-values for the statistic are computed.

 Usage: qlb = boxlj(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: qlb maxlag x 3 matrix, contains autocorrelation function in the first column, the Ljung-Box statistics in the second and the p-values for the statistic in the third column (see the notes).

Note:
Under the hypothesis that x is white noise, the Ljung-Box statistic is asymptotically distributed as Chi-Square with p degrees of freedom. Here, p is the respective lag for which the statistic is computed.

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
qlb    = boxlj(return,6) ; calculates the acf, lb-stat and p-values
qlb

```
Result:
```Generates a matrix with the autocorrelation
function, the Ljung-Box statistics and the
corresponding p-values for the returns of the
German stock index DAX

Contents of qlb
[1,]  0.036135  0.34474  0.55709
[2,]  0.033234  0.63746  0.72706
[3,] -0.030004  0.87697  0.83098
[4,]  0.013575  0.92619  0.92077
[5,] -0.069839    2.234   0.8159
[6,]  -0.0488   2.8751  0.82434
```

Author: G. Moral, M. Fengler, 20030402 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006