1
我想估計已實現的GARCH(1,1)模型。在我的數據集,我有以下時間序列:已實現的GARCH - 在模型中指定了「已實現的沃爾」
ret <- replicate(1, rnorm(100))
RV <- replicate(1, rnorm(100))
date <- c(1:100)
我做到以下幾點:
install.packages("rugarch")
library(rugarch)
attspec <- ugarchspec(mean.model = list(armaOrder = c(0, 0), include.mean = FALSE), variance.model = list(model = 'realGARCH', garchOrder = c(1, 1)))
fit <- ugarchfit(spec=attspec, data=ret, solver = 'hybrid', realizedVol = RV[, 1])
最後一行後,我得到一個錯誤:realizedVol必須是XTS對象
我嘗試使用xts包中描述的示例將我的RV矩陣轉換爲xts對象:
require(xts)
rownames(RV) <- date
matrix_xts <- as.xts(RV,dateFormat='Date')
或
df_xts <- as.xts(as.data.frame(RV))
在這兩種情況下,錯誤是字符串不是標準明確的格式
所以,我應該爲了讓XTS objest爲合適的格式做實現了VOL規格?
做這些錯誤信息的意思: 警告消息: 1:In log(實現[1:長度(數據)]):產生的NaN 2:在.makefitmodel(garchmodel =「realGARCH」,f = .realgarchLLH,T = T,:rugarch - >警告:未能反轉粗麻布 – glarys
這與診斷有關 – adaien