Skip to content
Prev 12951 / 15274 Next

How to add lagged values to rugarch-model

Bob
Lasse,
Your problem is that you have NAs in your external regressor matrix.  Since
you lagged it twice, you have 2 NAs.  Try the code below.
Thanks for the reproducible example, it made it really easy.
Bob


require(rugarch)
require(quantmod)

x = runif(n = 1000, min = -5, max = 100)
ext.reg_lagged = cbind(Lag(x, k = 1), Lag(x, k = 2))
ext.reg = cbind(x + runif(n = 1000, min = 5, max = 20), x - runif(n = 1000,
min = 5, max = 15))

*x <- x[-c(1:2)]*
*ext.reg_lagged = ext.reg_lagged[-c(1:2), ]*

fit.spec <- ugarchspec(variance.model = list(model = "sGARCH",
                                                 garchOrder = c(1, 1)),
                       mean.model         = list(armaOrder = c(3, 1),
                                                 include.mean = TRUE,
                                                 external.regressors =
                           ext.reg_lagged), # with ext.reg.lagged it does
not work.
                       distribution.model = "sstd")
fit      <- ugarchfit(data = x, spec = fit.spec, solver = "hybrid")
On Wed, Nov 5, 2014 at 9:16 AM, Lasse Thorst <thorstlasse at gmail.com> wrote: