在R中实现GARCH模型的问题

时间:2019-06-09 19:30:16

标签: r

我正在尝试实现DCC Garch模型,但是当最终出现时,我会写下该错误。我试图在该站点上找到解决方案,并且正如您看到的那样,我在dccfit函数的日期定义中输入all = FALSE,但是它似乎没有用,但是我确定今天早上它能用

library("fGarch")
library("rugarch")
library("rmgarch")
library(PerformanceAnalytics)
library(quantmod)
library(rugarch)
library(car)
library(FinTS)
library(tseries)

#carico i dati
sole24<- get.hist.quote(instrument = "S24.MI",  start = "2007-12-02",end  = "2016-06-26",  quote = "AdjClose", compression = "w")
enel <- get.hist.quote(instrument = "ENEL.MI",  start = "2007-12-02",end  = "2016-06-26",  quote = "AdjClose", compression = "w")
med<-get.hist.quote(instrument = "BMED.MI",  start = "2007-12-02",end  = "2016-06-26",  quote = "AdjClose", compression = "w")
intesa<- get.hist.quote(instrument = "ISP.MI",  start = "2007-12-02",end  = "2016-06-26",  quote = "AdjClose", compression = "w")
pi2<- get.hist.quote(instrument = "PQ.MI",  start = "2007-12-02",end  = "2016-06-26",  quote = "AdjClose", compression = "w")

#calcolo i logaritmi
log(sole24)
log(enel)
log(intesa)
log(pi2)
log(med)

#calcolo i log-rendimenti
sole24<-diff(log(sole24))
colnames(sole24)=c("log")
med<-diff(log(med))
colnames(med)=c("log")
pi2<-diff(log(pi2))
colnames(pi2)=c("log")
intesa<-diff(log(intesa))
colnames(intesa)=c("log")
enel<-diff(log(enel))
colnames(enel)=c("log")


#calcolo un garch(1,1) per ogni serie
garchuni = ugarchspec(mean.model = list(armaOrder = c(0,0), include.mean=FALSE), 
                          variance.model = list(garchOrder = c(1,1), 
                                                model = "tGARCH"), 
                          distribution.model = "norm")
# calcolo il Garch multivariato
dcc.garchuni= dccspec(uspec = multispec( replicate(5, garchuni) ), 
                           dccOrder = c(1,1), 
                           distribution = "mvnorm")
dcc.garchuni

#DCC
Plot.Log.Rendimento <- merge(sole24, med, pi2,intesa, enel,all = FALSE)
dcc.fit = dccfit(dcc.garchuni, data = na.omit(Plot.Log.Rendimento) )

and this is the error:
Error in UseMethod("convergence") : 
  no applicable method for 'convergence' applied to an object of class "NULL"

0 个答案:

没有答案