- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
第一次在这里提问,我会尽力明确 - 但请告诉我是否应该提供更多信息!其次,这是一个很长的问题......希望对某人来说很容易解决;)!因此,我使用“R”根据一些论文(Manera 等人,2012 年)对多元 GARCH 模型进行建模。
我使用均值方程中的外部回归量对恒定条件相关性 (CCC) 和动态条件相关性 (DCC) 模型进行建模;对于具有外部回归量的单变量 GARCH,使用“R”版本 3.0.1 和包“rugarch”版本 1.2-2,对于 CCC/DCC 模型使用“ccgarch”包(版本 0.2.0-2)。 (我目前正在研究“rmgarch”包 - 但它似乎仅适用于 DCC,我也需要 CCC 模型。)
我的模型的平均方程存在问题。在我上面提到的论文中,CCC和DCC模型之间的均值方程的参数估计发生了变化!我不知道如何在 R 中做到这一点......(目前,在Google上查找Tsay的书“金融时间序列分析”和Engle的书“预期相关性”来发现我的错误)
我所说的“我的平均方程在 CCC 和 DCC 模型之间不会改变”的意思是:我使用 rugarch 包为 n=5 时间序列指定单变量 GARCH。然后,我使用 GARCH 的估计参数(ARCH + GARCH 项)并将它们用于 CCC 和 DCC 函数“eccc.sim()”和“dcc.sim()”。然后,从 eccc.estimation() 和 dcc.estimation() 函数,我可以检索方差方程以及相关矩阵的估计值。但不适用于均值方程。
我只发布了单变量模型和 CCC 模型的 R 代码(可重现的和我原来的代码)。谢谢你阅读我的帖子!!!!
注意:在下面的代码中,“data.repl”是一个尺寸为 843x22 的“zoo”对象(9 个每日商品返回系列和解释变量系列)。多元 GARCH 仅适用于 5 系列。
可重现的代码:
# libraries:
library(rugarch)
library(ccgarch)
library(quantmod)
# Creating fake data:
dataRegr <- matrix(rep(rnorm(3149, 11, 1),1), ncol=1, nrow=3149)
dataFuelsLag1 <- matrix(rep(rnorm(3149, 24, 8),2), ncol=2, nrow=3149)
#S&P 500 via quantmod and Yahoo Finance
T0 <- "2000-06-23"
T1 <- "2012-12-31"
getSymbols("^GSPC", src="yahoo", from=T0, to=T1)
sp500.close <- GSPC[,"GSPC.Close"],
getSymbols("UBS", src="yahoo", from=T0, to=T1)
ubs.close <- UBS[,"UBS.Close"]
dataReplic <- merge(sp500.close, ubs.close, all=TRUE)
dataReplic[which(is.na(dataReplic[,2])),2] <- 0 #replace NA
### (G)ARCH modelling ###
#########################
# External regressors: macrovariables and all fuels+biofuel Working's T index
ext.regr.ext <- dataRegr
regre.fuels <- cbind(dataFuelsLag1, dataRegr)
### spec of GARCH(1,1) spec with AR(1) ###
garch11.fuels <- as.list(1:2)
for(i in 1:2){
garch11.fuels[[i]] <- ugarchspec(mean.model = list(armaOrder=c(1,0),
external.regressors = as.matrix(regre.fuels[,-i])))
}
### fit of GARCH(1,1) AR(1) ###
garch11.fuels.fit <- as.list(1:2)
for(i in 1:2){
garch11.fuels.fit[[i]] <- ugarchfit(garch11.fuels[[i]], dataReplic[,i])
}
##################################################################
#### CCC fuels: with external regression in the mean eqaution ####
##################################################################
nObs <- length(data.repl[-1,1])
coef.unlist <- sapply(garch11.fuels.fit, coef)
cccFuels.a <- rep(0.1, 2)
cccFuels.A <- diag(coef.unlist[6,])
cccFuels.B <- diag(coef.unlist[7, ])
cccFuels.R <- corr.test(data.repl[,fuels.ind], data.repl[,fuels.ind])$r
# model=extended (Jeantheau (1998))
ccc.fuels.sim <- eccc.sim(nobs = nObs, a=cccFuels.a, A=cccFuels.A,
B=cccFuels.B, R=cccFuels.R, model="extended")
ccc.fuels.eps <- ccc.fuels.sim$eps
ccc.fuels.est <- eccc.estimation(a=cccFuels.a, A=cccFuels.A,
B=cccFuels.B, R=cccFuels.R,
dvar=ccc.fuels.eps, model="extended")
ccc.fuels.condCorr <- round(corr.test(ccc.fuels.est$std.resid,
ccc.fuels.est$std.resid)$r,digits=3)
我的原始代码:
### (G)ARCH modelling ###
#########################
# External regressors: macrovariables and all fuels+biofuel Working's T index
ext.regr.ext <- as.matrix(data.repl[-1,c(10:13, 16, 19:22)])
regre.fuels <- cbind(fuel.lag1, ext.regr.ext) #fuel.lag1 is the pre-lagged series
### spec of GARCH(1,1) spec with AR(1) ###
garch11.fuels <- as.list(1:5)
for(i in 1:5){
garch11.fuels[[i]] <- ugarchspec(mean.model = list(armaOrder=c(1,0),
external.regressors = as.matrix(regre.fuels[,-i])))
}# regre.fuels[,-i] => "-i" because I model an AR(1) for each mean equation
### fit of GARCH(1,1) AR(1) ###
garch11.fuels.fit <- as.list(1:5)
for(i in 1:5){
j <- i
if(j==5){j <- 7} #because 5th "fuels" is actually column #7 in data.repl
garch11.fuels.fit[[i]] <- ugarchfit(garch11.fuels[[i]], as.matrix(data.repl[-1,j])))
}
#fuelsLag1.names <- paste(cmdty.names[fuels.ind], "(-1)")
fuelsLag1.names <- cmdty.names[fuels.ind]
rowNames.ext <- c("Constant", fuelsLag1.names, "Working's T Gasoline", "Working's T Heating Oil",
"Working's T Natural Gas", "Working's T Crude Oil",
"Working's T Soybean Oil", "Junk Bond", "T-bill",
"SP500", "Exch.Rate")
ic.n <- c("Akaike", "Bayes")
garch11.ext.univSpec <- univ.spec(garch11.fuels.fit, ols.fit.ext, rowNames.ext,
rowNum=c(1:15), colNames=cmdty.names[fuels.ind],
ccc=TRUE)
##################################################################
#### CCC fuels: with external regression in the mean eqaution ####
##################################################################
# From my GARCH(1,1)-AR(1) model, I extract ARCH and GARCH
# in order to model a CCC GARCH model:
nObs <- length(data.repl[-1,1])
coef.unlist <- sapply(garch11.fuels.fit, coef)
cccFuels.a <- rep(0.1, length(fuels.ind))
cccFuels.A <- diag(coef.unlist[17,])
cccFuels.B <- diag(coef.unlist[18, ])
#based on Engle(2009) book, page 31:
cccFuels.R <- corr.test(data.repl[,fuels.ind], data.repl[,fuels.ind])$r
# model=extended (Jeantheau (1998))
# "allow the squared errors and variances of the series to affect
# the dynamics of the individual conditional variances
ccc.fuels.sim <- eccc.sim(nobs = nObs, a=cccFuels.a, A=cccFuels.A,
B=cccFuels.B, R=cccFuels.R, model="extended")
ccc.fuels.eps <- ccc.fuels.sim$eps
ccc.fuels.est <- eccc.estimation(a=cccFuels.a, A=cccFuels.A,
B=cccFuels.B, R=cccFuels.R,
dvar=ccc.fuels.eps, model="extended")
ccc.fuels.condCorr <- round(corr.test(ccc.fuels.est$std.resid,
ccc.fuels.est$std.resid)$r,digits=3)
colnames(ccc.fuels.condCorr) <- cmdty.names[fuels.ind]
rownames(ccc.fuels.condCorr) <- cmdty.names[fuels.ind]
lowerTri(ccc.fuels.condCorr, rep=NA)
最佳答案
您是否知道有一整套rmgarch对于多元 GARCH 模型?
根据其描述,它涵盖
Feasible multivariate GARCH models including DCC, GO-GARCH and Copula-GARCH.
关于R - 多元 GARCH 建模(rugarch 和 ccgarch),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16874375/
我正在寻找可以从 Eclipse 的 UML 图生成代码的工具。该工具应该从 UML 图生成代码,进行逆向工程以查看代码更改,并提供合并选项以防止因任何更改而删除文件。 是否有工具可以做到这一点,或者
我正在寻找有关建模的见解。我有一个关于设计模式和基本类图、序列图和用例的介绍类(class)。 我发现类图作为我编程中的组织工具非常宝贵。到目前为止,用例还算有用。 本学期我正在上课,更深入地学习 U
如何使用 flutter 数据建模技术访问“HH”和“mm”。我一直在尝试按以下方式使用它,但是下面给出了错误。 我的数据模型当前为它的简化版本。 class Week { final Strin
我正在使用 Neo4j 和 PHP。在我的项目中,我有餐厅节点。每个节点都有纬度、经度和分类属性。 我需要返回与用户给定分类相匹配的餐厅节点,其结果按距用户位置的距离排序(即第一个最近的餐厅)。 最简
我希望 POJO 包含一个 Status 字段(只有两个可能的值 SUCCESS、FAILED),并且根据此状态,第二个字段需要为 POJO 对象(如果 Status 为 SUCCESS) 或只是字符
我正在尝试将我的办公室迁移到数据库应用程序中。这是我得到的: (来源:phunkei.de) 公司和个人从客户继承(1:1关系)。这是因为他们都可以是“客户”并收到账单,我想引用订单中的单个表。公司和
我目前有这个数据库结构: 一个条目可以有多个"file"、“文本”和“url”类型的项目。 这些项目中的每一项在文本、网址或文件表(存储数据的位置)中都有一个对应的项目。 我需要一个查询来有效地选择一
下面的代码不应该像“if(condition)”语句一样工作吗,当它在另一个循环中并且“body”有自己的 break 或 continue 语句时,会出现明显的错误行为: for( ; condit
我一直在像这样存储和递增下载计数器: INCRBY downloads: 1 但现在我想要下载:* 按值排序,以便显示热门下载列表。 我觉得我可以更好地存储它。我愚弄了: ZINCRBY downlo
我开始使用图形数据库,在我的团队中,我们已经开始为我们的软件建模图形。当我们尝试“记录”模型以查看数据库的结构时,问题就出现了。对于 SQL 数据库,您只需查看 SQL 模式。 我们花了一些时间阅读
我正在做一个固定效应回归并且遇到了自相关问题,为了解决这个问题,我正在使用预测、lmtest 和 plm 包进行 ARIMA 建模。我的数据是一般面板数据,looks like this ,我正在尝试
我想知道是否有任何工具可以帮助我对 C 应用程序(即函数式编程)进行建模。例如。我目前正在构建一个共享库。但是为了直观地传达我的设计,我需要类似 UML 的东西。我想这样做,以便审查我的设计的人不需要
我正在尝试将 JSON 转换为 GSON ,但我无法建模。谁能给我举个例子。 [ { "id": "1", "name": "lalala",
正如标题所说,在 中建模 optional 参数的最佳方法是什么?斯卡拉 ? 对于 optional 参数,我的意思是执行函数体不需要的值。 要么因为该参数存在默认值,要么根本不需要该参数本身(例如配
我发现 UML 可用于记录 OO 系统的各个方面,尤其是用于整体架构的类图和用于说明特定例程的序列图。我想为我的 clojure 应用程序做同样的事情。我目前对模型驱动开发不感兴趣,只是在交流应用程序
我想知道是否有人知道如何使用 UML 在属性中建模 DateTime 基元类型? 最佳答案 我想这取决于日期的格式......请参阅下面的示例,其中我使用两个整数(分别为日和年)和一个名为“Month
我有一些与我的问题建模相关的问题。我正在研究基于模型的测试的论文项目。还想从专家的角度了解我是否采用正确的方法来建模我的场景。我正在对 Android 应用程序的 UI 进行建模,遍历它们,生成测试用
我正在尝试建立对 CouchDB 以及如何为某些现实世界场景建模数据的理解。我现在已经尽可能多地“按日期获取我的博客文章”;) 给定这样的文件: { "_id": "couch1",
一个模型资源是如何分层的?例如假设一个人有一个“留言板”并且“消息”是一种资源。假设“消息”可以有回复,从而形成一个讨论线程。如何模拟线程的概念? “消息”是否包含它的子项? “线程”是它自己的资源吗
我正在尝试创建一个像通用 POJO 一样工作的对象,因为我必须通过不同的对象传递它,并且我需要一个接口(interface)来访问其属性。 目前,我使用具有 getField 方法的基础对象来完成此操
我是一名优秀的程序员,十分优秀!