Hello, i have four variables in a csv format file (A,B,C,D), i can run dcc model in r without external regressors but now i want to put two variables (C,D), into the mean equation and also both of them in variance equation and other two variables (A,B) are dependent variables. Now kindly guide me how can i make a command for DCC model while using rmgarch package in r studio. i shall be grateful to you, please answer my query...
spec <- ugarchspec(variance.model = list(model = "sGARCH", garchOrder = c(1, 1),submodel = NULL, external.regressors = matrix(cbind(stocka$PAK,stocka$IND),ncol = 2), variance.targeting = FALSE), mean.model = list(armaOrder = c(0, 0), external.regressors = matrix(cbind(stocka$PAK,stocka$IND),ncol = 2),distribution.model = "norm", start.pars = list(), fixed.pars = list()))
spec2 = multispec(replicate(4, spec))
cl1 = makePSOCKcluster(4)
multft = multifit(uspec, stocka, cluster = cl1)
multft
specmv = dccspec(uspec = uspec, dccOrder = c(1, 1), (external.regressors = stocka$PAK,stocka$IND), ncol = 2)), distribution = 'mvnorm')
fitmv = dccfit(specmv, data = stocka, fit.control = list(eval.se = TRUE), fit = multf, cluster = cl)
fitmv
i have tried this model as i said i want to put two variables (stocka$PAK and stocka$IND) into mean and as well as variance equation of multivariate garch. my all command are working at the multft stage, as you can see results of multft command below but i am unable to set the dccspec command denoted by "specmv" in the above commands and got the following error. now help me to set dccspec command and further commands for complete results. I shall be thankful to you.
multft results
----------------------------
-
GARCH Multi-Fit *
----------------------------
No. Assets :4
GARCH Multi-Spec Type : Equal
GARCH Model Spec
Model : sGARCH
Exogenous Regressors in variance equation: 2
Mean Equation :
Include Mean : 1
AR(FI)MA Model : (0,d,0)
GARCH-in-Mean : FALSE
Exogenous Regressors in mean equation: 2
Conditional Distribution: norm
GARCH Model Fit
Optimal Parameters:
WTI IND PAK BAN
mu 3505.89032 0.000 0.00000 217.65067
mxreg1 3.74979 0.000 1.00000 0.66725
mxreg2 2.05562 1.000 0.00000 0.20710
omega 20042.42826 2670.472 86.44499 60.16874
alpha1 0.82333 0.050 0.05000 0.49192
beta1 0.00000 0.900 0.90000 0.47664
vxreg1 0.00000 0.000 0.00000 0.00000
vxreg2 0.00000 0.000 0.00000 0.01040
Log-Lik -16089.42721 -13584.784 -9701.77805 -11366.07593
as you can see here two external regressors are shown in mean and as well as in variance equation but i am unable to get them in dcc.
dccspec error given by R studio.
Error: unexpected ',' in "specmv = dccspec(uspec = uspec, dccOrder = c(1, 1), (external.regressors = stocka$PAK,"
i also tried to change this command like this
specmv = dccspec(uspec = uspec, dccOrder = c(1, 1), (external.regressors = matrix(cbind(stocka$PAK,stocka$IND), ncol = 2)), distribution = 'mvnorm')
Warning message:
In if (VAR) { :
the condition has length > 1 and only the first element will be used
fitmv = dccfit(specmv, data = stocka, fit.control = list(eval.se = TRUE), fit = multf, cluster = cl)
Error in .dccfit(spec = spec, data = data, out.sample = out.sample, solver = solver, :
The user supplied fit object has a non-null mean specification but VAR already chosen for mean filtration!!!
so this is my problem now help me please to overcome this. i am new but passionate to learn R. kindly help me...