DCC-GARCH model and AR(1)-GARCH(1, 1) regression model

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

DCC-GARCH model and AR(1)-GARCH(1, 1) regression model

Marcin P?�ciennik
Hello,
I sent this message a couple of times to r-help group but unfortunately did not get any response that would be helpful...

I have a rather complex problem... I will have to explain everything in detail because I cannot solve it by myself...i just ran out of ideas. So here is what I want to do:
I take quotes of two indices - S&P500 and DJ. And my first aim is to estimate coefficients of the DCC-GARCH model for them. This is how I do it:


library(tseries)
p1 = get.hist.quote(instrument = "^gspc",start = "2005-01-07",end = "2009-09-04",compression = "w", quote="AdjClose")
p2 = get.hist.quote(instrument = "^dji",start = "2005-01-07",end = "2009-09-04",compression = "w", quote="AdjClose")
p = cbind(p1,p2)
y = diff(log(p))*100
y[,1] = y[,1]-mean(y[,1]) 
y[,2] = y[,2]-mean(y[,2])
T = length(y[,1])

library(ccgarch)
library(fGarch)

f1 = garchFit(~ garch(1,1), data=y[,1],include.mean=FALSE)
f1 = f1@fit$coef
f2 = garchFit(~ garch(1,1), data=y[,2],include.mean=FALSE)
f2 = f2@fit$coef

a = c(f1[1], f2[1])
A = diag(c(f1[2],f2[2]))
B = diag(c(f1[3], f2[3]))
dccpara = c(0.2,0.6)
dccresults = dcc.estimation(inia=a, iniA=A, iniB=B, ini.dcc=dccpara,dvar=y, model="diagonal")

dccresults$out
DCCrho = dccresults$DCC[,2]
matplot(DCCrho, type='l')

dccresults$out deliver me the estimated coefficients of the DCC-GARCH model. And here is my first question:
How can I check if these coefficients are significant or not? How can I test them for significance?

and the second one:
What is actually dccpara and why do I get totally different DCC-alpha and DCC-beta coefficients if I change dccpara from c(0.2,0.6) to, let's say, c(0.01, 0.98) ? What determines which values should be chosen?


Ok. This would be it when it comes to DCC-GARCH.

Now, using conditional correlation obtained from the DCC-GARCH model, I want to test for structural shifts in conditional correlations. To be precise, I want to test whether the conditional correlations significantly increase in the turmoil period / during the Subprime crisis.
The regression model is AR(1)-GARCH(1,1), using a dummy variable specified as:



*** the equations, you can find in the attachment ***



where the first equation is the conditional correlation among the two indices during the Subprime crisis, Dt is a dummy variable for the turmoil period, and the second equation (hij,t) is the conditional variance of eij,t


The aim is, of course, to find the estimates of the regression model on structural shifts in the conditional correlations obtained in the DCC-GARCH model.

I found an information that there is no function for AR(1)-GARCH(1,1) regression model. That's why it has to be done in two steps:
1) estimate the AR parameters
2) estimate the GARCH part of the model on the residuals from the AR model

And this would be my rather poor idea of how to do it...


library(timeSeries)
library(fSeries)
library(tseries)
step1 = arma(DCCrho, order = c(1,0), include.intercept = TRUE)
step1$res
step11 = na.remove(step1$res)
step2 = garch (step11, order = c(1,1), include.intercept = TRUE)


To be honest I have no clue how to do it. I don't even now why do I get a missing value as a result of step1 (step1$res[1]) and how to account for it? Above, I just removed it but then I have a smaller number of observations...and this is probably wrong.
And then these GARCH estimates on the residuals...does the code for that make sense at all?


Hopefully, someone will find time to give me a hand because I have to solve the problem and I reached the point where I cannot move forward without someone's help. There is not much information on how to apply DCC-GARCH model and AR(1)-GARCH(1,1) regression model in the Internet. Hopefully, some of you are familiar with it.

Thank you very much in advance, people of good will, for looking at what I wrote and helping me.

Best regards
Marcin



_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.

Equations.pdf (63K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

garchFit NaNs produced

Yihao Lu aeolus_lu

Hello,I am new to Garch and have some problem when using garchFit in fGarchI have a simple data series as:y <- c(0.,-0.0067691,-0.00681523,-0.00210637,-0.00581551,0.00211864,-0.00477328,0.00212427,-0.01658235,-0.00921166,0.00867214,-0.01139768,0.00544367,0.00811034,0.00161421,-0.00539085,0.00753908,-0.01950224,-0.00328767,0.00547347,-0.01152909,0.,-0.00110497,-0.00110619,0.01537647,0.00272109,0.00054333,-0.02030248,-0.0050014,0.00666299,0.01592128,-0.00327333,0.01032899,0.00054069,0.0010805,0.00753097,0.00107124,-0.00482963,-0.00647601,-0.00054157)

When I use this in  g <- garchFit(~arma(1,0)+garch(1,1),y)
I got the warning msg: In sqrt(diag(fit$cvar)) : NaNs produced
I guess this is to do with optimizer (nlminb) here but I m not sure what kind of control parameter I should try to handle this.
Thank you.

     
        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: garchFit NaNs produced

Arun.stat
Hi Yihao, not very sure on your situation, but are you sure that your data have any Garch effect at all? Prima-facie it seems that your data dont have. Why you want to fit garch model in such case?

Thanks and regards,
_____________________________________________________

Arun Kumar Saha, FRM
QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
Visit me at: http://in.linkedin.com/in/ArunFRM
_____________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: garchFit NaNs produced

Yihao Lu aeolus_lu

Hi, Arunthanks for your reply. I checked my dataset and figured seems there was problem in my dataset. Thank you.
Best,
Yihao





> Date: Tue, 24 May 2011 12:07:43 -0700
> From: [hidden email]
> To: [hidden email]
> Subject: Re: [R-SIG-Finance] garchFit NaNs produced
>
> Hi Yihao, not very sure on your situation, but are you sure that your data
> have any Garch effect at all? Prima-facie it seems that your data dont have.
> Why you want to fit garch model in such case?
>
> Thanks and regards,
> _____________________________________________________
>
> Arun Kumar Saha, FRM
> QUANTITATIVE RISK AND HEDGE CONSULTING SPECIALIST
> Visit me at: http://in.linkedin.com/in/ArunFRM
> _____________________________________________________
>
> --
> View this message in context: http://r.789695.n4.nabble.com/DCC-GARCH-model-and-AR-1-GARCH-1-1-regression-model-tp3546727p3547947.html
> Sent from the Rmetrics mailing list archive at Nabble.com.
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
     
        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|

Re: DCC-GARCH model and AR(1)-GARCH(1, 1) regression model

Kenton Russell
In reply to this post by Marcin P?�ciennik
Not real familiar with DCC-GARCH but I will look into it so you are not alone.  I used the rgarch package here with good results
http://timelyportfolio.blogspot.com/2011/05/wonderful-new-blog-timeseriesireland.html

Kent

On May 24, 2011, at 5:53 AM, Marcin P?�ciennik <[hidden email]> wrote:

> Hello,
> I sent this message a couple of times to r-help group but unfortunately did not get any response that would be helpful...
>
> I have a rather complex problem... I will have to explain everything in detail because I cannot solve it by myself...i just ran out of ideas. So here is what I want to do:
> I take quotes of two indices - S&P500 and DJ. And my first aim is to estimate coefficients of the DCC-GARCH model for them. This is how I do it:
>
>
> library(tseries)
> p1 = get.hist.quote(instrument = "^gspc",start = "2005-01-07",end = "2009-09-04",compression = "w", quote="AdjClose")
> p2 = get.hist.quote(instrument = "^dji",start = "2005-01-07",end = "2009-09-04",compression = "w", quote="AdjClose")
> p = cbind(p1,p2)
> y = diff(log(p))*100
> y[,1] = y[,1]-mean(y[,1])  
> y[,2] = y[,2]-mean(y[,2])
> T = length(y[,1])
>
> library(ccgarch)
> library(fGarch)
>
> f1 = garchFit(~ garch(1,1), data=y[,1],include.mean=FALSE)
> f1 = f1@fit$coef
> f2 = garchFit(~ garch(1,1), data=y[,2],include.mean=FALSE)
> f2 = f2@fit$coef
>
> a = c(f1[1], f2[1])
> A = diag(c(f1[2],f2[2]))
> B = diag(c(f1[3], f2[3]))
> dccpara = c(0.2,0.6)
> dccresults = dcc.estimation(inia=a, iniA=A, iniB=B, ini.dcc=dccpara,dvar=y, model="diagonal")
>
> dccresults$out
> DCCrho = dccresults$DCC[,2]
> matplot(DCCrho, type='l')
>
> dccresults$out deliver me the estimated coefficients of the DCC-GARCH model. And here is my first question:
> How can I check if these coefficients are significant or not? How can I test them for significance?
>
> and the second one:
> What is actually dccpara and why do I get totally different DCC-alpha and DCC-beta coefficients if I change dccpara from c(0.2,0.6) to, let's say, c(0.01, 0.98) ? What determines which values should be chosen?
>
> Ok. This would be it when it comes to DCC-GARCH.
>
> Now, using conditional correlation obtained from the DCC-GARCH model, I want to test for structural shifts in conditional correlations. To be precise, I want to test whether the conditional correlations significantly increase in the turmoil period / during the Subprime crisis.
> The regression model is AR(1)-GARCH(1,1), using a dummy variable specified as:
>
>
>
>
> *** the equations, you can find in the attachment ***
>
>
>
>
>
> where the first equation is the conditional correlation among the two indices during the Subprime crisis, Dt is a dummy variable for the turmoil period, and the second equation (hij,t) is the conditional variance of eij,t
>
>
> The aim is, of course, to find the estimates of the regression model on structural shifts in the conditional correlations obtained in the DCC-GARCH model.
>
> I found an information that there is no function for AR(1)-GARCH(1,1) regression model. That's why it has to be done in two steps:
> 1) estimate the AR parameters
> 2) estimate the GARCH part of the model on the residuals from the AR model
>
> And this would be my rather poor idea of how to do it...
>
>
> library(timeSeries)
> library(fSeries)
> library(tseries)
> step1 = arma(DCCrho, order = c(1,0), include.intercept = TRUE)
> step1$res
> step11 = na.remove(step1$res)
> step2 = garch (step11, order = c(1,1), include.intercept = TRUE)
>
>
> To be honest I have no clue how to do it. I don't even now why do I get a missing value as a result of step1 (step1$res[1]) and how to account for it? Above, I just removed it but then I have a smaller number of observations...and this is probably wrong.
> And then these GARCH estimates on the residuals...does the code for that make sense at all?
>
>
> Hopefully, someone will find time to give me a hand because I have to solve the problem and I reached the point where I cannot move forward without someone's help. There is not much information on how to apply DCC-GARCH model and AR(1)-GARCH(1,1) regression model in the Internet. Hopefully, some of you are familiar with it.
>
> Thank you very much in advance, people of good will, for looking at what I wrote and helping me.
>
> Best regards
> Marcin
>
>
> <Equations.pdf>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
        [[alternative HTML version deleted]]


_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.