[R-SIG-Finance] rmgarch: dccforecast() and mregfor
Alexios Ghalanos
alexios at 4dscape.com
Mon Sep 2 13:20:50 CEST 2013
If you have a multivariate conditional mean specification (i.e. VAR) then you cannot have a univariate conditional mean specification (arma model)...they are mutually exclusive. In short, do not enter anything for mean.model in ugarchspec (include.mean is automatically set to FALSE if VAR is selected).
-Alexios
On 2 Sep 2013, at 11:44 AM, Cedric Membrez <cedric.membrez at gmail.com> wrote:
> Dear all,
>
> I'm a first time user of this list. Please let me know if I need to provide
> more info,etc.
> I have a question regarding dccforecast() and the number of external
> regressors needed.
>
> I'm using the dccforecast() function from the package "rmgarch" and use the
> simple DCC model and a AR(1)-GARCH(1,1). The forecast works fine when I do
> NOT include external regressors. However, I have an error message from the
> dccforecast() function when I include the external regressors in the
> external.forecasts=list(mregfor = ...) option.
>
> "Error: dccforecast-->error: wrong number of external regressors!..."
>
>> From the documentation, I understand that I need to have unconstraint
> forecast of my ext. regr and these regressors must be the same as in the
> ugarchspec(). I googled my problem, but nothing helpful came up. Anyone see
> the mistake here ? I appreciate your help :) thanks!
>
> Here are the main steps I took and my code is below.
>
> step (1): univariate GARCH specification with ARMA(1,0), GARCH(1,1) and a
> 842x17 matrix of external regressors. Then, I create a multispec object.
> step (2): varxfit( ... data matrix of 758x6, and regressors of 758x17
> dimensions)
> step (3): dccspec( multispec, ext.regr of 842x17 dimensions)
> dccfit( dccspec, data of 842x6 and out.sample=84)
> step (4) dccforecast ( dccfit, n.ahead = 1 , n.roll = 5, mregfor of
> dimension 842.17 )
> ==> and I get the embarrassing message with "wrong number of ext.
> regressors!..."
>
> My code:
> ###########################################################
> uniGarchSpec <- ugarchspec(mean.model = list(armaOrder=c(1,0),
> external.regressors =
> lag(extRegr)),
>
> variance.model=list(model="sGARCH",
> garchOrder=c(1,1)))
> multiGarchSpec <- multispec(replicate(6, uniGarchSpec))
> # VAR
> varFit <- varxfit(X=data.agriFact[-outSample.ind,c(5:9, 23)],
> p=1, postpad='constant', robust=FALSE,
> ns=200,
> exogen=extRegr[-outSample.ind,])
> # DCC
> dccSpec <- dccspec(multiGarchSpec, VAR=TRUE, robust=FALSE,
> lag=1, lag.max=NULL,
> external.regressors=lag(extRegr),
> robust.control = list("gamma" = 0.25,
> "delta" = 0.01, "nc" =
> 10, "ns" = 250),
> dccOrder=c(1,1), model=c("DCC"),
> distribution=c("mvt"),
> start.pars=list(dcca1=0.05, dccb1=0.816))
> dccFit <- dccfit(dccSpec, data=lag(data.agriFact[,c(5:9, 23)]),
> VAR.fit = varFit, out.sample=84)
> # Forecast
> dccForecast <- dccforecast(dccFit, n.ahead=1,n.roll=5,
> external.forecasts=list(mregfor=lag(extRegr)))
> ###########################################################
>
> [[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.
>
More information about the R-SIG-Finance
mailing list