我想使用 R 中 rugarch 包中未内置的发行版。更具体地说,是 EGB2 发行版。如果我有该分布的 PDF,那么是否可以在我的模型中使用该分布,例如这样?
# Defining the model specification
spec <- ugarchspec(
variance.model = list(
model = "eGARCH",
garchOrder = c(1, 1)
),
mean.model = list(
armaOrder = c(1, 1),
include.mean = TRUE
),
distribution.model = "eGB2"
)
在这里,它不会将“eGB2”识别为分发模型,但是有什么办法可以做到这一点吗?
我已经将发行版的 PDF 编写为 R 中的函数,但我不知道如何将其与 rugarch 包一起使用
如果不破解
{rugarch}
包本身,这似乎是不可能的。如果您查看包源代码,您会发现:
if(is.null(distribution.model)) modeldesc$distribution = "norm"
valid.distribution = c("norm", "snorm", "std", "sstd","ged", "sged", "nig", "ghyp", "jsu", "ghst")
distribution = distribution.model
if(!is.character(distribution[1]))
stop("\nugarchspec-->error: cond.distribution argument must be a character")
if(!any(distribution==valid.distribution))
stop("\nugarchspec-->error: the cond.distribution does not appear to be a valid choice.")
检查
distribution.model
的指定值是否是有效选项之一(“norm”、“snorm”、“std”、“sstd”、“ged”、“sged”、“nig”、“ghyp” 、“jsu”或“ghst”),如果没有,则停止并出现错误。
您可以从 https://github.com/alexiosg/rugarch 分叉该软件包的副本并进行调整以支持您的新发行版。包维护者很可能会很高兴收到包含您建议的更改的拉取请求。或者,您可以要求软件包维护者更新软件包以支持您的发行版。