Page 3 of 6

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Mon Jan 30, 2017 11:30 am
by jack
You are right. But I want to see if introduction of futures contract has brought about a high wolatility regime? I want to see if this event has increased the volatility. The methodology is based on this paper. http://onlinelibrary.wiley.com/doi/10.1 ... 3/abstract.The authors have implemented this method.

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Tue Jan 31, 2017 10:03 am
by TomDoan
The paper you cited would be more convincing if they did an apples vs apples comparison. The dummy variable model only changes the variance constant in the GARCH while the MS-GARCH model changes everything (mean model, all variance model parameters and the degrees of freedom of the t). Even with all the extra parameters, the improvement in the LL for Nikkei, FTSE and S&P aren't all that large.

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Tue Jan 31, 2017 10:24 am
by jack
I really appreciate your excellent comments on the paper.
Is it possible to have a code for their model here?
And one more question. How can I compute LB statistic for squared residuals of Regime-switching GARCH in Gray's paper?

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Wed Feb 01, 2017 1:17 pm
by jack
Dear Tom,
I want to compute Ljung-Box statistic for serial correlation of the squared residuals of Regime-switching GARCH model in Gray's paper.
I used the following code after maximize instruction but I'm not sure whether it is correct or not:

Code: Select all

set ustd = %dot(pt_t1,||(rate-a01-a11*rate{1})/b01,(rate-a02-a12*rate{1})/b02||)
I would be grateful if you could possibly guide me about it.

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Wed Feb 01, 2017 3:43 pm
by jack
Dear Tom,
I estimated a model based on Gray's paper and here is the results. The Ljung-Box statistics relating
to the squared standardized residuals indicate significant serial correlation. Does it show that something is wrong with the model?
GARCH Model - Estimation by BFGS
Convergence in    23 Iterations. Final criterion was  0.0000041 <=  0.0000100
Dependent Variable RATE
Daily(5) Data From 2003:01:03 To 2012:12:06
Usable Observations                      2590
Log Likelihood                     -1106.0489

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  Constant                     -0.009116152  0.004583112     -1.98907  0.04669295
2.  RATE{1}                       0.035172878  0.022646726      1.55311  0.12039663

3.  C                             0.001088115  0.000282215      3.85562  0.00011543
4.  A                             0.246598747  0.026254036      9.39279  0.00000000
5.  B                             0.791129966  0.018299852     43.23150  0.00000000

Lag  Corr  Partial   LB Q    Q Signif
  1  0.053   0.053  7.155283    0.0075
  2 -0.008  -0.011  7.314639    0.0258
  3 -0.024  -0.023  8.800338    0.0321
  4  0.032   0.035 11.463173    0.0218
  5 -0.005  -0.009 11.533096    0.0418
  6 -0.030  -0.030 13.918315    0.0306
  7 -0.030  -0.025 16.257684    0.0229
  8 -0.024  -0.023 17.751739    0.0232
  9 -0.031  -0.030 20.225390    0.0166
 10 -0.016  -0.012 20.850930    0.0222
 11 -0.026  -0.025 22.658262    0.0197
 12 -0.019  -0.018 23.600898    0.0230
 13 -0.027  -0.026 25.444931    0.0202
 14 -0.039  -0.040 29.388071    0.0093
 15 -0.037  -0.036 32.917932    0.0048


MAXIMIZE - Estimation by BFGS
Convergence in     2 Iterations. Final criterion was  0.0000050 <=  0.0000100
Daily(5) Data From 2003:01:03 To 2012:12:06
Usable Observations                      2590
Function Value                     -1054.0329

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  A01                           0.013549085  0.012540572      1.08042  0.27995519
2.  A02                          -0.014930348  0.004370346     -3.41629  0.00063482
3.  A11                           0.064567104  0.029604611      2.18098  0.02918480
4.  A12                          -0.064066500  0.034049382     -1.88158  0.05989361
5.  B01                           0.067479479  0.005412803     12.46664  0.00000000
6.  B11                           0.135819468  0.013344841     10.17768  0.00000000
7.  B21                           0.808728790  0.017795344     45.44609  0.00000000
8.  B02                           0.003753066  0.000429312      8.74204  0.00000000
9.  B12                           0.312228200  0.047843182      6.52608  0.00000000
10. B22                           0.294668993  0.019177199     15.36559  0.00000000


MAXIMIZE - Estimation by BFGS
Convergence in    22 Iterations. Final criterion was  0.0000006 <=  0.0000100
Daily(5) Data From 2003:01:03 To 2012:12:06
Usable Observations                      2590
Function Value                     -1049.7041

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  A01                           0.010332656  0.012722085      0.81218  0.41668686
2.  A02                          -0.015752333  0.004410645     -3.57144  0.00035503
3.  A11                           0.066010875  0.030439228      2.16861  0.03011215
4.  A12                          -0.086271210  0.037563514     -2.29668  0.02163728
5.  B01                           0.050481058  0.009854571      5.12260  0.00000030
6.  B11                           0.156253488  0.032079328      4.87085  0.00000111
7.  B21                           0.805724006  0.051333920     15.69574  0.00000000
8.  B02                           0.003278824  0.001207730      2.71487  0.00663027
9.  B12                           0.229633335  0.069779573      3.29084  0.00099889
10. B22                           0.249913547  0.039345596      6.35175  0.00000000
11. P(1,1)                        0.959801475  0.014292487     67.15427  0.00000000
12. P(1,2)                        0.076891035  0.021664827      3.54912  0.00038652

Lag  Corr  Partial   LB Q    Q Signif
  1 0.0339  0.0339  2.988551    0.0839
  2 0.0330  0.0319  5.815595    0.0546
  3 0.0209  0.0188  6.950812    0.0735
  4 0.0580  0.0558 15.691318    0.0035
  5 0.0679  0.0634 27.684503    0.0000
  6 0.0430  0.0356 32.499693    0.0000
  7 0.0521  0.0445 39.564417    0.0000
  8 0.0292  0.0194 41.786765    0.0000
  9 0.0177  0.0056 42.605573    0.0000
 10 0.0320  0.0206 45.269952    0.0000
 11 0.0659  0.0541 56.593080    0.0000
 12 0.0233  0.0090 58.003813    0.0000
 13 0.0301  0.0184 60.358844    0.0000
 14 0.0519  0.0414 67.379388    0.0000
 15 0.0336  0.0184 70.331039    0.0000
I used the following code for computing the LB statistics for Regime-switching GARCH model:

Code: Select all

set ustd = %dot(pt_t1,||(rate-a01-a11*rate{1})/b01,(rate-a02-a12*rate{1})/b02||)

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Thu Feb 02, 2017 12:18 pm
by jack
Dear Tom,
I want to compute Ljung-Box statistic for serial correlation of the squared residuals of Regime-switching GARCH model in Gray's paper. I used the following code (after maximize instruction) for this purpose but the results are very different from those in the paper:

Code: Select all

set ustd2 = %dot(pt_t1,||(rate-a01-a11*rate{1})/b01,(rate-a02-a12*rate{1})/b02||)
set usqr2 = ustd^2
@regcorrs(report,number=15) usqr2

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Thu Feb 02, 2017 2:51 pm
by TomDoan
The first three are actually fine---it's after that that the test seems to have problems. First of all, the LB test is based upon assumptions that might not hold (and probably don't) in this situation---you might get a different result with the more robust West-Cho test. Also, it's not clear what the effect is on the multi-step diagnostics of the way the "memory" is cut off by the filtering process.

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Thu Feb 02, 2017 3:16 pm
by jack
Dear Tom,
1. When I want to reproduce LB for the squared residuals of Regime-switching GARCH model in Gray's paper (by the following code), the results are very different from those in the paper. what's wrong with it?

Code: Select all

set ustd2 = %dot(pt_t1,||(rate-a01-a11*rate{1})/b01,(rate-a02-a12*rate{1})/b02||)
set usqr2 = ustd^2
@regcorrs(report,number=15) usqr2
2. Can I make statistical inference based on the LB that shows significant correlations after the third lag?
3. Is there any remedy for my model?

I would be really grateful if I can possibly have your insightful comments.

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Thu Feb 02, 2017 9:24 pm
by TomDoan
Gray never really defines what he means, but it looks like this works (in the sense that it appears to very closely match his results):

set usqr gstart gend = uu(t)/h(t)
@regcorrs(title="Squared Standardized Residuals from MS GARCH",$
number=15,report) usqr

This can be applied to all of the MS GARCH models. (What you were computing is definitely not correct, since you're only taking the variance constant part of the GARCH recursion).

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Fri Feb 03, 2017 9:23 am
by jack
Dear Tom,
I run the code after the maximize instruction but I got the following error:

SX11. Identifier GSTART is Not Recognizable. Incorrect Option Field or Parameter Order?
>>>>set usqr gstart <<<<

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Fri Feb 03, 2017 9:33 am
by TomDoan
Use 2 * instead of gstart gend.

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Fri Feb 03, 2017 3:38 pm
by jack
Dear Tom,
I'm really confused.
I'm using Gray's paper for modeling my daily exchange rate returns. There are strange results. When I estimate a simple GARCH model, the coefficient of AR(1) term in mean equation is statistically insignificant and positive. But the Ljung-Box statistics relating to the standardized residuals indicate significant serial correlation.

But when I estimate a Regime-switching GARCH model, the coefficients of AR(1) terms in mean equations are statistically significant and negative (and positive). And the Ljung-Box statistics relating to the standardized residuals indicate no serial correlation.

I'm really confused. I don't know how to interpret these results. Is it possible to have such results? Is something wrong with the model?

Code: Select all

GARCH Model - Estimation by BFGS
Convergence in    23 Iterations. Final criterion was  0.0000041 <=  0.0000100
Dependent Variable RATE
Daily(5) Data From 2003:01:03 To 2012:12:06
Usable Observations                      2590
Log Likelihood                     -1106.0489

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  Constant                     -0.009116152  0.004583112     -1.98907  0.04669295
2.  RATE{1}                       0.035172878  0.022646726      1.55311  0.12039663

3.  C                             0.001088115  0.000282215      3.85562  0.00011543
4.  A                             0.246598747  0.026254036      9.39279  0.00000000
5.  B                             0.791129966  0.018299852     43.23150  0.00000000

Lag  Corr  Partial   LB Q    Q Signif
  1  0.101   0.101 26.498775    0.0000
  2  0.030   0.020 28.797444    0.0000
  3  0.041   0.036 33.131069    0.0000
  4  0.036   0.028 36.542802    0.0000
  5  0.035   0.027 39.646718    0.0000
  6  0.003  -0.006 39.664611    0.0000
  7  0.042   0.039 44.273612    0.0000
  8 -0.012  -0.023 44.649073    0.0000
  9 -0.009  -0.009 44.864559    0.0000
 10  0.043   0.042 49.584950    0.0000
 11 -0.027  -0.036 51.470142    0.0000
 12  0.005   0.009 51.537103    0.0000
 13 -0.037  -0.038 55.046241    0.0000
 14  0.011   0.016 55.336143    0.0000
 15  0.023   0.023 56.758591    0.0000

Regime-switching GARCH:

MAXIMIZE - Estimation by BFGS
Convergence in    22 Iterations. Final criterion was  0.0000006 <=  0.0000100
Daily(5) Data From 2003:01:03 To 2012:12:06
Usable Observations                      2590
Function Value                     -1049.7041

    Variable                        Coeff      Std Error      T-Stat      Signif
************************************************************************************
1.  A01                           0.010332656  0.012722085      0.81218  0.41668686
2.  A02                          -0.015752333  0.004410645     -3.57144  0.00035503
3.  A11                           0.066010875  0.030439228      2.16861  0.03011215
4.  A12                          -0.086271210  0.037563514     -2.29668  0.02163728
5.  B01                           0.050481058  0.009854571      5.12260  0.00000030
6.  B11                           0.156253488  0.032079328      4.87085  0.00000111
7.  B21                           0.805724006  0.051333920     15.69574  0.00000000
8.  B02                           0.003278824  0.001207730      2.71487  0.00663027
9.  B12                           0.229633335  0.069779573      3.29084  0.00099889
10. B22                           0.249913547  0.039345596      6.35175  0.00000000
11. P(1,1)                        0.959801475  0.014292487     67.15427  0.00000000
12. P(1,2)                        0.076891035  0.021664827      3.54912  0.00038652

Lag  Corr  Partial   LB Q    Q Signif
  1  0.027   0.027  1.934771    0.1642
  2 -0.018  -0.019  2.791808    0.2476
  3 -0.042  -0.041  7.414761    0.0598
  4 -0.029  -0.027  9.548227    0.0488
  5 -0.009  -0.009  9.753434    0.0825
  6 -0.020  -0.022 10.767742    0.0958
  7 -0.021  -0.022 11.861776    0.1052
  8  0.002   0.001 11.877841    0.1567
  9  0.014   0.010 12.358070    0.1939
 10  0.042   0.038 16.870462    0.0773
 11  0.011   0.008 17.207434    0.1019
 12  0.003   0.004 17.225406    0.1413
 13  0.025   0.028 18.802433    0.1294
 14  0.009   0.011 19.022561    0.1641
 15  0.007   0.010 19.152047    0.2069

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Sun Feb 05, 2017 5:08 pm
by TomDoan
I don't find that at all odd. None of those coefficients are particularly large.

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Fri Jun 16, 2017 3:36 am
by jack
When I run the model I get this error:

NO CONVERGENCE IN 4 ITERATIONS
LAST CRITERION WAS 0.0000000
ESTIMATION POSSIBLY HAS STALLED OR MACHINE ROUNDOFF IS MAKING FURTHER PROGRESS DIFFICULT
TRY HIGHER SUBITERATIONS LIMIT, TIGHTER CVCRIT, DIFFERENT SETTING FOR EXACTLINE OR ALPHA ON NLPAR
RESTARTING ESTIMATION FROM LAST ESTIMATES OR DIFFERENT INITIAL GUESSES MIGHT ALSO WORK


Is there any way for handling this error?

Re: Gray JFE 1996 Markov Switching GARCH model

Posted: Fri Jun 16, 2017 9:06 am
by TomDoan
What model with what instructions? That usually means either really really bad guess values or so many preliminary iterations that the model is effectively converged and BFGS can't figure out the curvature.