command for Ljung-Box test Q2 (20)

Discussions of ARCH, GARCH, and related models
curiousresearcher
Posts: 41
Joined: Sun May 19, 2019 9:56 pm

command for Ljung-Box test Q2 (20)

Unread post by curiousresearcher »

Dear All,

Can someone share the commandcode for Ljung-Box test Q2 (20) to test for autocorrelation of squared returns for gold price returns?

I know how to compute Ljung-Box test Q(20) ) to test for autocorrelation of returns which is as follows:

TABLE
CORRELATE(NUMBER=20,QSTATS,METHOD=YULE) RGOLD

Please help
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: command for Ljung-Box test Q2 (20)

Unread post by TomDoan »

What people call (incorrectly) Ljung-Box Q2 is actually McLeod-Li. Note that you do not square the series that you input---the test procedure takes care of that.
curiousresearcher
Posts: 41
Joined: Sun May 19, 2019 9:56 pm

Re: command for Ljung-Box test Q2 (20)

Unread post by curiousresearcher »

Dear Tom,

Thanks a lot.

I am sharing a sample data of one variable where there is presence of ARCH effect when i use @archtest .

But i am not getting any arch effect if i use @mcleodli . Also, i am not getting any autocorrelation when using Ljung-Box test

I am attaching the price and return data for silver in excel file. Also, i am attaching the commands used and output generated

Please guide me since there are more time series variables data like this where ARCH (@archtest)is present but no autocorrelation and mcledli ARCH effect. Am i doing it correctly? How to solve this dichotomy

The data file is attached.

The commands and results are as below:

Code: Select all

CORRELATE(NUMBER=20,QSTATS,DFC=2,METHOD=YULE) RSILVER
garch(reg,p=1,q=1,resids=u,hseries=h) / rsilver
# constant rsilver{2}
*
* Diagnostics
*
set ustd = u/sqrt(h)
@regcorrs(nograph,number=20,report) ustd
@mcleodli(number=20,dfc=2) ustd
stats Rsilver
*
linreg Rsilver / resids
# constant
*
@archtest(lags=10,form=lm,span=1) resids


Code: Select all

Correlations of Series RSILVER

Autocorrelations
   1         2          3         4        5        6        7        8        9        10
-0.02515    0.01193   -0.06868  0.04202 -0.02806  0.01077 -0.03095  0.05728 -0.04623 -0.04110
   11        12         13        14       15       16       17       18       19       20
-0.01100   -0.01383   -0.01454  0.00807 -0.01725 -0.01824 -0.01362 -0.02061  0.03485 -0.02338

Ljung-Box Q-Statistics
    Lags  Statistic Signif Lvl
      20     19.797   0.344390


GARCH Model - Estimation by BFGS
Convergence in    20 Iterations. Final criterion was  0.0000017 <=  0.0000100

Dependent Variable RSILVER
Usable Observations                       987
Log Likelihood                     -1992.2772

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  Constant                     0.0721689999 0.0534959689      1.34905  0.17731933
2.  RSILVER{2}                   0.0245381151 0.0326264375      0.75209  0.45199514

3.  C                            0.0414838447 0.0276081512      1.50259  0.13294375
4.  A                            0.0492185676 0.0161441952      3.04869  0.00229845
5.  B                            0.9379327563 0.0206990647     45.31281  0.00000000

Lag  Corr  Partial   LB Q    Q Signif
  1 -0.023  -0.023  0.517095    0.4721
  2  0.006   0.006  0.555545    0.7575
  3 -0.054  -0.054  3.496502    0.3212
  4  0.012   0.009  3.635271    0.4576
  5  0.001   0.002  3.635561    0.6030
  6  0.015   0.012  3.857443    0.6960
  7 -0.026  -0.024  4.527383    0.7174
  8  0.042   0.041  6.302961    0.6133
  9 -0.017  -0.014  6.586970    0.6800
 10 -0.041  -0.045  8.282809    0.6012
 11  0.002   0.005  8.286469    0.6874
 12 -0.018  -0.020  8.604287    0.7363
 13 -0.019  -0.024  8.955373    0.7763
 14  0.008   0.007  9.022174    0.8296
 15 -0.026  -0.025  9.692101    0.8386
 16 -0.018  -0.023 10.025659    0.8653
 17  0.015   0.015 10.265977    0.8921
 18 -0.024  -0.022 10.823113    0.9017
 19  0.051   0.046 13.411033    0.8169
 20 -0.008  -0.005 13.468611    0.8564


McLeod-Li Test for Series USTD
Using 987 Observations from 3 to 989
                Test Stat    Signif
McLeod-Li(20-2) 22.8768283    0.19537


Statistics on Series RSILVER
Observations                   989
Sample Mean               0.083944      Variance                   3.636784
Standard Error            1.907035      SE of Sample Mean          0.060640
t-Statistic (Mean=0)      1.384297      Signif Level (Mean=0)      0.166580
Skewness                 -0.182917      Signif Level (Sk=0)        0.019034
Kurtosis (excess)         1.212699      Signif Level (Ku=0)        0.000000
Jarque-Bera              66.117685      Signif Level (JB=0)        0.000000


Linear Regression - Estimation by Least Squares
Dependent Variable RSILVER
Usable Observations                       989
Degrees of Freedom                        988
Centered R^2                       -0.0000000
R-Bar^2                            -0.0000000
Uncentered R^2                      0.0019358
Mean of Dependent Variable       0.0839440217
Std Error of Dependent Variable  1.9070354716
Standard Error of Estimate       1.9070354716
Sum of Squared Residuals         3593.1428786
Log Likelihood                     -2041.2788
Durbin-Watson Statistic                2.0503

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  Constant                     0.0839440217 0.0606402001      1.38430  0.16658024


Test for ARCH in RESIDS
Using data from 1 to 989

Lags Statistic Signif. Level
   1     6.862       0.00881
   2    21.664       0.00002
   3    26.983       0.00001
   4    24.598       0.00006
   5    34.080       0.00000
   6    35.458       0.00000
   7    35.691       0.00001
   8    45.759       0.00000
   9    56.335       0.00000
  10    73.391       0.00000
Attachments
estimaquery_6august.xlsx
(40.72 KiB) Downloaded 788 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: command for Ljung-Box test Q2 (20)

Unread post by TomDoan »

That's exactly what you *hope* to see. The standardized residuals (standardized for GARCH variances) are showing no remaining serial correlation or "ARCH".
curiousresearcher
Posts: 41
Joined: Sun May 19, 2019 9:56 pm

Re: command for Ljung-Box test Q2 (20)

Unread post by curiousresearcher »

TomDoan wrote:That's exactly what you *hope* to see. The standardized residuals (standardized for GARCH variances) are showing no remaining serial correlation or "ARCH".
Dear Tom,

I think i was not able to frame my question properly. I am initially looking to perform pre dignostic test on original return series for silver for descriptive statistics section.

I think the previous command which i applied is for " post diagnostic on the standardized residuals from a GARCH model to test for remaining ARCH effects"

So should i apply the following command instead as these results confirm ARCH effect/correlation ins squared returns like the ARCH LM Test

@mcleodli(number=20) rsilver

Output:
McLeod-Li Test for Series RSILVER
Using 989 Observations from 1 to 989
Test Stat Signif
McLeod-Li(20-0) 177.503003 0.00000

Please confirm. Also, please tell the right command for Ljung Q(20) test for autocorrelation testing pre diagnostic before fitting of any model. Maybe, the command which i had used is checking for post left over autocorrelation which should go away as you said (ideally preliminary return series of silver should display autocorrelation)


References

I am asking since few research papers which i saw there all these three tests show significance for pre diagnostic univariate data for all the variables which will eventually be used for a M-GARCH model. But in my case only ARCH LM test confirm hetroskedicity , but Mcleodi doesn't. Also no prsence of prediagnostic serial correlation.

E.g. this paper https://doi.org/10.1016/j.resourpol.2019.04.004 (Pg no 4/10)

I will be quoting the authors here in the preliminary analysis section " Q2 According to the Ljung-Box test Q(20) and (20) results, we provide evidence for serial correlations for both the residuals and squared residuals at 1% significance level".


Another paper - https://www.sciencedirect.com/science/a ... 8308000261

I quote the authors "Ljung–Box tests for autocorrelation show that the returns on crude oil display significant autocorrelation in the in-sample and the overall sample, but not in the out-of-sample period. Additionally, the Ljung–Box tests for autocorrelation in the squared returns are all significant, indicating the second-order moments are related. Consequently, the GARCH model which captures the relation in the second-order moment may generate superior VaR forecasts relative to the C&M method."
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: command for Ljung-Box test Q2 (20)

Unread post by TomDoan »

McLeod-Li (like Ljung-Box for serial correlation in the mean) can be affected by choice of the number of lags. If the second moment dependence is relatively mild and is primarily on the short lags, then @ARCHTEST, which looks only at the short lags will be more powerful than McLeod-Li which treats all the covered lags the same.

You don't necessarily want to see (or expect to see) serial correlation in the mean for returns series. The point in the last quote is that if it is there and you ignore it, then the VaR that you compute ignoring it will be incorrect.
Post Reply