Box jenkins problem trying find to best fit model
Box jenkins problem trying find to best fit model
Hi, i am trying to find a model of best fit for daily stock % returns using the box jenkins method to test for volatility . My problem for all these models
i am getting back no auto present with Ljung Box Qstat and for the Q4 is coming back blank for ARMA 1,2 AND ARMA 2,. All the Qstats are giving back 0.0000 for every model.
I am not sure if my code is wrong or if its something else. I would really appreciate if anyone could help
thanks
spgraph(hfi=1,vfi=3,hea= ' AIB Returns')
graph(hea='AIB Returns') 1 ; # RAIB
spgaph(done)
correlate(partial=pacf,qstats,number=12,span=4) RAIB
source(noecho) c:\winrats\bjident.src
@bjident RAIB
*AR(1)
boxjenk(constant,ar=1) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
* AR(2)
boxjenk(constant,ar=2) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
*MA(1)
boxjenk(constant,ma=1) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
*ARMA(1,1)
boxjenk(constant,ar=1,ma=1) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
*ARMA(1,2)
boxjenk(constant,ar=1,ma=2) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
*ARMA(2,1)
boxjenk(constant,ar=2,ma=1) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
i am getting back no auto present with Ljung Box Qstat and for the Q4 is coming back blank for ARMA 1,2 AND ARMA 2,. All the Qstats are giving back 0.0000 for every model.
I am not sure if my code is wrong or if its something else. I would really appreciate if anyone could help
thanks
spgraph(hfi=1,vfi=3,hea= ' AIB Returns')
graph(hea='AIB Returns') 1 ; # RAIB
spgaph(done)
correlate(partial=pacf,qstats,number=12,span=4) RAIB
source(noecho) c:\winrats\bjident.src
@bjident RAIB
*AR(1)
boxjenk(constant,ar=1) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
* AR(2)
boxjenk(constant,ar=2) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
*MA(1)
boxjenk(constant,ma=1) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
*ARMA(1,1)
boxjenk(constant,ar=1,ma=1) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
*ARMA(1,2)
boxjenk(constant,ar=1,ma=2) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
*ARMA(2,1)
boxjenk(constant,ar=2,ma=1) RAIB / resids
cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids
compute aic=%nobs*log(%rss)+2*%nreg
compute sbc=%nobs*log(%rss)+%nreg*log(%nobs)
display 'aic=' aic 'sbc=' sbc
Re: Box jenkins problem trying find to best fit model
There is no particular reason why, for a given data set, there should be an ARMA model that produces residuals that pass a Q-statistic whiteness test. First off, not every series has an ARMA representation---if there are structural breaks, for instance, there is no full sample ARMA representation. Also, the Q statistic is valid only if the residuals are (conditionally) homoscedastic. If you have GARCH residuals, the p-values for the Q can be off, and can be off quite considerably. GARCH means that large residuals tend to cluster together, so the correlations of e(t)e(t-k) for k small will be dominated by the few large combinations seen in the data set. As an alternative to a standard Q, you can use the West-Cho test (http://www.estima.com/forum/viewtopic.php?f=7&t=1458) which is a Q-test but robust to conditional heteroscedasticity.
Re: Box jenkins problem trying find to best fit model
Thanks for your reply Tom,
I took the dfc=%nreg out of the code from here cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids and reran it.
The Qstats completely changed. is this part of the code necessary for the procedure to run correctly
I took the dfc=%nreg out of the code from here cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids and reran it.
The Qstats completely changed. is this part of the code necessary for the procedure to run correctly
Re: Box jenkins problem trying find to best fit model
The statistics shouldn't change, it's the significance levels which change. You should be using %NARMA, not %NREG for the degrees of freedom correction, as the CONSTANT doesn't count against the degrees of freedom. And yes, you are supposed to correct the degrees of freedom for the number of ARMA parameters.GaryM26 wrote:Thanks for your reply Tom,
I took the dfc=%nreg out of the code from here cor(partial=pacf,qstats,number=12,span=4,dfc=%nreg) resids and reran it.
The Qstats completely changed. is this part of the code necessary for the procedure to run correctly
Re: Box jenkins problem trying find to best fit model
Thanks tom,
sorry for being a pain, but my next problem is, i am trying to run the ARMA models of best fit for my return series in garch.
i want to run ARMA (4,2) Garch ,ARMA (3,2) Garch and
ARMA (1,1) Garch.
i am not very sure how to fit in the ARMA model in to the mean equation with the wizard.
Do i run the ARMA (4,2) model save the resids.
then in the ARCH/GARCH wizard :
dependent variable input option = returns
Mean Model Variables input option = returns { 1 to 4 } lags + saved resids from the ARMA 4,2 model { 1 to 2}
I am not sure this is correct
sorry for being a pain, but my next problem is, i am trying to run the ARMA models of best fit for my return series in garch.
i want to run ARMA (4,2) Garch ,ARMA (3,2) Garch and
ARMA (1,1) Garch.
i am not very sure how to fit in the ARMA model in to the mean equation with the wizard.
Do i run the ARMA (4,2) model save the resids.
then in the ARCH/GARCH wizard :
dependent variable input option = returns
Mean Model Variables input option = returns { 1 to 4 } lags + saved resids from the ARMA 4,2 model { 1 to 2}
I am not sure this is correct
Re: Box jenkins problem trying find to best fit model
No. You want to estimate the mean model as part of the GARCH. This is covered on page UG-286 of the RATS v8 User's Guide. However, an ARMA(4,2) sounds way too complicated for a return series. If you found a return series with that much serial correlation, quit your studies and start trading. Start with a more modest model, fit the GARCH to it and do the diagnostics before trying to make a more complicated mean model.
Re: Box jenkins problem trying find to best fit model
Hi Tom,
I checked out the manual after your advice.
for a MA2 for Garch (1,1) In the wizard, would I put into the Mean Model Variables section:
%mvgavge{2} or %mvgavge{1 to 2} im not sure which is correct
I checked out the manual after your advice.
for a MA2 for Garch (1,1) In the wizard, would I put into the Mean Model Variables section:
%mvgavge{2} or %mvgavge{1 to 2} im not sure which is correct
Re: Box jenkins problem trying find to best fit model
%mvgavge{1 2}
Re: Box jenkins problem trying find to best fit model
Id be lost without you Tom really appreciate your help, I know my questions my are very basic but im trying to learn.
I am trying to get the impact of the short selling ban on the volatility in stock returns. i used a MA 2 Garch 1,1 with a dummy both in the mean and variance.
I am trying to interpret the diagnostics on the standardized residuals. If the P- value is > 0.05 doe it mean the model is good? as well i wasn't sure of the degrees of freedom
The Mcleod-Li test AIC = 5.270 BIC =5.292 Q = 32.59 p-value = 0.71763
LB TEST AIC = 5.270 BIC = 5.292 Q = 48.21 p-value = 0.14809
I included the code below and the results
Results
GARCH Model - Estimation by BHHH
Convergence in 35 Iterations. Final criterion was 0.0000083 <= 0.0000100
Dependent Variable RAIB
Daily(5) Data From 2005:01:03 To 2012:08:30
Usable Observations 1999
Log Likelihood -5259.4329
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant 0.033340949 0.043073568 0.77405 0.43890323
2. Mvg Avge{1} 0.063047603 0.023842929 2.64429 0.00818626
3. Mvg Avge{2} -0.034745816 0.025635552 -1.35538 0.17529773
4. DS -0.522207528 0.183760639 -2.84178 0.00448623
5. C 0.147418127 0.024176602 6.09755 0.00000000
6. A 0.249926403 0.015005713 16.65542 0.00000000
7. B 0.729607587 0.014278372 51.09879 0.00000000
8. DS 3.103225502 0.357931207 8.66989 0.00000000
Statistics on Series USTD
Daily(5) Data From 2005:01:03 To 2012:08:30
Observations 1999
Sample Mean -0.012468 Variance 0.995983
Standard Error 0.997990 SE of Sample Mean 0.022321
t-Statistic (Mean=0) -0.558573 Signif Level (Mean=0) 0.576516
Skewness 0.218689 Signif Level (Sk=0) 0.000066
Kurtosis (excess) 2.535654 Signif Level (Ku=0) 0.000000
Jarque-Bera 551.460914 Signif Level (JB=0) 0.000000
I am trying to get the impact of the short selling ban on the volatility in stock returns. i used a MA 2 Garch 1,1 with a dummy both in the mean and variance.
I am trying to interpret the diagnostics on the standardized residuals. If the P- value is > 0.05 doe it mean the model is good? as well i wasn't sure of the degrees of freedom
The Mcleod-Li test AIC = 5.270 BIC =5.292 Q = 32.59 p-value = 0.71763
LB TEST AIC = 5.270 BIC = 5.292 Q = 48.21 p-value = 0.14809
I included the code below and the results
Code: Select all
CALENDAR(D) 2004:12:31
DATA(FORMAT=XLSX,ORG=COLUMNS) 2004:12:31 2012:08:30 PAIB RAIB PBOI RBOI PTSB RTSB PISEQ RISEQ
SET DS = T>=2008:09:18.AND.T<=2012:08:30
GARCH(P=1,Q=1,RESIDS=U,HSERIES=H,XREGRESSORS,REGRESSORS,METHOD=BHHH) / RAIB
# Constant %MVGAVGE{1 2} DS
# DS
set ustd = u/sqrt(h)
set ustdsq = ustd^2
@regcorrs(qstat,number=40,dfc=1,title="LB Test") ustd
@regcorrs(qstat,number=40,dfc=2,title="McLeod-Li Test") ustdsq
stats ustd
GARCH Model - Estimation by BHHH
Convergence in 35 Iterations. Final criterion was 0.0000083 <= 0.0000100
Dependent Variable RAIB
Daily(5) Data From 2005:01:03 To 2012:08:30
Usable Observations 1999
Log Likelihood -5259.4329
Variable Coeff Std Error T-Stat Signif
************************************************************************************
1. Constant 0.033340949 0.043073568 0.77405 0.43890323
2. Mvg Avge{1} 0.063047603 0.023842929 2.64429 0.00818626
3. Mvg Avge{2} -0.034745816 0.025635552 -1.35538 0.17529773
4. DS -0.522207528 0.183760639 -2.84178 0.00448623
5. C 0.147418127 0.024176602 6.09755 0.00000000
6. A 0.249926403 0.015005713 16.65542 0.00000000
7. B 0.729607587 0.014278372 51.09879 0.00000000
8. DS 3.103225502 0.357931207 8.66989 0.00000000
Statistics on Series USTD
Daily(5) Data From 2005:01:03 To 2012:08:30
Observations 1999
Sample Mean -0.012468 Variance 0.995983
Standard Error 0.997990 SE of Sample Mean 0.022321
t-Statistic (Mean=0) -0.558573 Signif Level (Mean=0) 0.576516
Skewness 0.218689 Signif Level (Sk=0) 0.000066
Kurtosis (excess) 2.535654 Signif Level (Ku=0) 0.000000
Jarque-Bera 551.460914 Signif Level (JB=0) 0.000000
Re: Box jenkins problem trying find to best fit model
Your diagnostics look fine. You might want to try using t rather than Normal errors (DISTRIB=T) option, given the high kurtosis on the standardized residuals.
The degrees of freedom correction for the Q should be 2 = # of ARMA parameters
The degrees of freedom correction for the McLeod-Li should be 2 = # of GARCH parameters (lagged variance/residual squared terms).
The degrees of freedom correction for the Q should be 2 = # of ARMA parameters
The degrees of freedom correction for the McLeod-Li should be 2 = # of GARCH parameters (lagged variance/residual squared terms).
Re: Box jenkins problem trying find to best fit model
Cheers Tom,
so the end result is theres no auto left in the residuals and it does a good job explaining the volatility.
and if the P-value from the tests is > 0.5 there no auto left i.e the model is good.
one other thing the MA2 p-value is insignificant, should this significant whats the interpretation of it.
3. Mvg Avge{2} -0.034745816 0.025635552 -1.35538 0.17529773
thanks
so the end result is theres no auto left in the residuals and it does a good job explaining the volatility.
and if the P-value from the tests is > 0.5 there no auto left i.e the model is good.
one other thing the MA2 p-value is insignificant, should this significant whats the interpretation of it.
3. Mvg Avge{2} -0.034745816 0.025635552 -1.35538 0.17529773
thanks
Re: Box jenkins problem trying find to best fit model
Why should it be significant? If you don't need an MA(2) to explain the serial correlation...you don't need an MA(2) to explain the serial correlation.
Re: Box jenkins problem trying find to best fit model
I am trying to capture the volatility in the stock returns and the dummy variable to show what the impact short selling ban
had on it
had on it
Re: Box jenkins problem trying find to best fit model
So why would that mean that the MA(2) term should be significant?
Re: Box jenkins problem trying find to best fit model
I'm not sure, thats why i asked. I thought for some reason all the coefficients in the model needed to be.