首页 > 解决方案 > R并行包错误:一个节点产生错误:没有适用的“收敛”方法应用于“try-error”类的对象

问题描述

最近我一直在尝试自己研究 R 中的 2-stage DCC 模型。发现一篇很有帮助的文章:https ://www.r-bloggers.com/the-garch-dcc-model-and-2-stage-dccmvt-estimation/

但是,我被困在了

install.packages("rmgarch")
library(rmgarch)
install.packages("parallel")
library(parallel)
data(growthrates)
Dat = growthrates2[, 1:7, drop = FALSE]
# define a DCCspec object: 2 stage estimation should usually always use
# Normal for 1-stage (see below for
xspec = ugarchspec(mean.model = list(armaOrder = c(1, 1)), variance.model = list(garchOrder = c(1,1), model = 'eGARCH'), distribution.model = 'norm')
uspec = multispec(replicate(7, xspec))
spec1 = dccspec(uspec = uspec, dccOrder = c(1, 1), distribution = 'mvnorm')
spec1a = dccspec(uspec = uspec, dccOrder = c(1, 1), model='aDCC', distribution = 'mvnorm')
##  aDDC for asymmetric DCC; The distributions supported are the multivariate normal (“mvnorm”) and the multivariate affine NIG (“manig”) and GHYP (“magh”) distributions of Schmidt
spec2 = dccspec(uspec = uspec, dccOrder = c(1, 1), distribution = 'mvlaplace')
spec2a = dccspec(uspec = uspec, dccOrder = c(1, 1), model='aDCC', distribution = 'mvlaplace')

cl = makePSOCKcluster(7)
## stopCluster(cl)
showconnections()


print(class(cl))
multf = multifit(multispec=uspec, Dat, cluster = cl)

每一行代码都运行顺利,直到 multifit 的最后一行。错误显示:

> multf = multifit(multispec=uspec, Dat, cluster = cl)
Error in checkForRemoteErrors(val) : 
  one node produced an error: no applicable method for 'convergence' applied to an object of class "try-error"

我试图在网上搜索,有人说可能是数据集中存在 na 值,但我的数据集中没有 na 值。

那么错误的原因可能是什么?谢谢

编辑:在代码的最后一行将“dat2”替换为“Dat”以避免混淆。

标签: rparallel-processing

解决方案


推荐阅读