How to add lagged values to rugarch-model
ext.reg_lagged has NA's in the first few lines which are NOT allowed. Even though you are using an ARMA(3,1), the conditional mean model will still make use of those values for t+1,t+2 and t+3, together with the 'intercept'. Replace the NA's with either zero or their mean values (or anything other than NA). Alexios
On 05/11/2014 14:16, Lasse Thorst wrote:
Hi - First question here, so please bear with me:
I would like to added lagged values to a rugarch-model, but have been
unable to find answers in the vignette.
Basic test-code:
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))
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), # with ext.reg.lagged it does not work.
distribution.model = "sstd")
fit <- ugarchfit(data = x, spec = fit.spec, solver = "hybrid")
Now this works perfectly, but if I exchange the external.regressors =
ext.reg_lagged
it no longer works.
How can you do this in rugarch? Or do I need to try another package?
/Regards Lasse
[[alternative HTML version deleted]]
_______________________________________________ R-SIG-Finance at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-finance -- Subscriber-posting only. If you want to post, subscribe first. -- Also note that this is not the r-help list where general R questions should go.