首页 > 解决方案 > 使用 Ugarchroll 在 for 循环中拟合数据:如何摆脱以下警告消息?--> 可能的收敛问题:优化给出的代码 = 1

问题描述

我收到以下警告消息,我想摆脱但我不明白:

possible convergence problem: optim gave code = 1

贝娄是我的代码:

# Creating the specification with ugarchroll

library("rugarch")
garch_spec_N <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1)), mean.model = list(armaOrder = c(1, 1), include.mean = TRUE),distribution.model = "norm")

nsim <- 2 # number of simulations
nstart <- 500
simul_ <- matrix(rnorm(2000), nrow = 1000, ncol = nsim))

# Model fitting

garch_sigma_N <- garch_mu_N <- matrix(NA, nrow = nstart, ncol = nsim)
for (i in 1:nsim) {
 garch_fit_N <- ugarchroll(garch_spec_N, simul_[,i], n.ahead = 1,
                           forecast.length = 1, n.start = nstart,
                           refit.every = 1, refit.window = "moving",
                           window.size = nstart, calculate.VaR = TRUE,
                           VaR.alpha = alpha)
 
 # Retrieving estimated garch variance and Mu
 garch_sigma_N[,i] <- garch_fit_N@forecast[["density"]][["Sigma"]]
 garch_mu_N[,i] <- garch_fit_N@forecast[["density"]][["Mu"]]
}

任何帮助将不胜感激:)

标签: rfor-loop

解决方案


推荐阅读