Marcin P?�ciennik
2011-May-12 19:41 UTC
[R] DCC-GARCH model and AR(1)-GARCH(1,1) regression model
Hello, 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 at fit$coef f2 = garchFit(~ garch(1,1), data=y[,2],include.mean=FALSE) f2 = f2 at 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? second question would be: Is this true that matplot(DCCrho, type='l') shows conditional correlation between the two indices in question? 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) 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 that make sense at all? I know the mail is quite looong, but 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
Marcin P?�ciennik
2011-May-14 10:28 UTC
[R] DCC-GARCH model and AR(1)-GARCH(1,1) regression model
Hello, 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 at fit$coef f2 = garchFit(~ garch(1,1), data=y[,2],include.mean=FALSE) f2 = f2 at 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? second question would be: Is this true that matplot(DCCrho, type='l') shows conditional correlation between the two indices in question? 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) 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 that make sense at all? I know the mail is quite looong, but 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
Marcin P?�ciennik
2011-May-14 12:07 UTC
[R] DCC-GARCH model and AR(1)-GARCH(1,1) regression model
Hello, 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 at fit$coef f2 = garchFit(~ garch(1,1), data=y[,2],include.mean=FALSE) f2 = f2 at 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? second question would be: Is this true that matplot(DCCrho, type='l') shows conditional correlation between the two indices in question? 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) 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 that make sense at all? I know the mail is quite looong, but 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: Equations.pdf Type: application/pdf Size: 47651 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110514/7b286451/attachment.pdf>