[R-SIG-Finance] External Regressors in GARCH Equation when using Twinkle
Neil Patrick Lawton
ne||@|@wton2 @end|ng |rom m@||@dcu@|e
Thu Sep 12 01:54:53 CEST 2019
Hello all,
I am having trouble with the inclusion of external regressors in the GARCH
equation, when using the twinkle package kindly provided by Alexios
Ghalanos.
I believe I am including the data correctly to starspec. An xts object,
which is pre-lagged and has the same index as the data included within
starfit optimization.
Below, I have included an example of my code, with some generated data.
library(xts)
library(twinkle)
xts1 <- xts(x=rnorm(100), order.by=Sys.Date()-1:100)
xts2 <- xts(x=rnorm(100), order.by=index(xts1))
spec = starspec(mean.model = list(states = 2,
include.intercept = c(1,1),
arOrder = c(1,1),
maOrder = c(2, 2),
matype="state",
statevar = 'y',
ylags = 3,
statear = TRUE),
variance.model=list(dynamic=TRUE,
model="sGARCH",submodel = NULL,
garchOrder=c(1,1),
vreg=xts1,
variance.targeting = FALSE),
distribution.model = "norm")
ctrl=list(maxit=1000, alpha=0.2, beta=0.1, gamma=0.7, reltol=1e-12,
trace=0,method="BFGS",n.restarts=2,rseed=1)
mod = starfit(spec, data = xts2,
solver.control = ctrl,
solver = "msoptim")
I get the following error when trying to run, which only occurs when the
'vreg' argument is included in the variance model:
Error in matrix(vexdata, ncol = modelinc[39]) :
object 'vexdata' not found
I get errors with other solvers also, whether I am including the
solver.control list or not.
In the rugarch package, the external regressors should be included as a
matrix, not an xts object. However, when I include data as a matrix here, I
get: starspec-->error: vreg must be an xts object.
Is there a solution or work around to this problem?
Kind regards,
Neil
--
__
Séanadh Ríomhphoist/_
Email Disclaimer__
**
Tá an ríomhphost seo agus
aon chomhad a sheoltar leis faoi rún agus is lena úsáid ag an seolaí agus
sin amháin é. Is féidir tuilleadh a léamh anseo.
<https://www4.dcu.ie/iss/seanadh-riomhphoist.shtml>
<https://www4.dcu.ie/iss/seanadh-riomhphoist.shtml>*
_
This e-mail and any
files transmitted with it are confidential and are intended solely for use
by the addressee. Read more here.
<https://www4.dcu.ie/iss/email-disclaimer.shtml> _
*_
[[alternative HTML version deleted]]
More information about the R-SIG-Finance
mailing list