[R-SIG-Finance] ugarchspec: external regressors

alexios galanos alexios at 4dscape.com
Tue May 24 01:36:05 CEST 2016


I think the error message is quite informative:
"...unused argument (external.regressors...)

The "external.regressors" goes either in the mean.model or
variance.model list.
You are passing it outside, so you get an error. I did mention to you
when you
emailed me offline that it might be useful to carefully check the
ugarchspec specification and what you are passing.

A quick "arguments" check usually helps:

>args(ugarchspec)
function (
variance.model = list(model = "sGARCH", garchOrder = c(1, 1),
submodel = NULL, external.regressors = NULL, variance.targeting = FALSE),
mean.model = list(armaOrder = c(1, 1), include.mean = TRUE,
archm = FALSE, archpow = 1, arfima = FALSE, external.regressors = NULL,
archex = FALSE),
distribution.model = "norm", start.pars = list(), fixed.pars = list(), ...)


Alexios

On 23/05/2016 16:02, FAKIR CHARLES wrote:
> Hi All,
>
> I am running rugarch Version: 1.3-5 and am trying to simulate the paper:
> “High-low range in GARCH models of stock return volatility” SSRN:
> http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2753336, for my thesis.
>
> I am able to run sGARCH with no problems. The paper though, calls to
> “estimate a GARCH(0,1) model with an exogenous variable” This is where it
> goes all pear shape. I have modelled the volatility using the TTR package:
> “train.vGK <- volatility(train.ohlc, calc="garman")
> train.vParkinson <- volatility(train.ohlc, calc="parkinson")”
>
> The result is an xts object, as expected considering my input class is xts,
> and the dimensions after some adjustments:
>
>> str(close.djdr)
> An ‘xts’ object on 1993-01-15/2009-04-24 containing:
>   Data: num [1:4100, 1] 0.000979 0.001161 -0.005788 -0.004309 0.003387 ...
>  - attr(*, "dimnames")=List of 2
>   ..$ : NULL
>   ..$ : chr "daily.returns"
>   Indexed by objects of class: [Date] TZ: UTC
>   xts Attributes:
>  NULL
>
>> str(train.vParkinson)
> An ‘xts’ object on 1993-01-15/2009-04-24 containing:
>   Data: num [1:4100, 1] 0.0866 0.0853 0.0875 0.088 0.0772 ...
>  - attr(*, "dimnames")=List of 2
>   ..$ : NULL
>   ..$ : chr "vParkinson"
>   Indexed by objects of class: [Date] TZ: UTC
>   xts Attributes:
>  NULL
>
> When I try to run the ugarchspec, it fails miserably:
>> spec1X=ugarchspec(variance.model=list(model="sGARCH"),
> + external.regressors = train.vParkinson[,1],  #What is the correct form
> here? I have lagged it: train.xreg = lag(train.vParkinson,1)
> + mean.model=list(armaOrder=c(0,0)))
> Error in .local(variance.model, mean.model, distribution.model,
> start.pars,  :
>   unused argument (external.regressors = c(0.0866063373770964,
> 0.0853297963049413, 0.0875414180301314, 0.0880414499227675,
> 0.0771631965517572, 0.0707091044790502, 0.0778057119517414,
> 0.0775765066940466, 0.077820690394834, 0.0752388231276861,
> 0.072436404409338, 0.07452357235863, 0.0710133687112722,
> 0.0817565181849798, 0.0900172823007909, 0.0930080887667925,
> 0.0896830143657568, 0.089774572544706, 0.0904325308768051,
> 0.092930283058663, 0.0964456153316399, 0.123570155397932,
> 0.125244790062196, 0.138922401992731,
> 0.135292796408894, 0.134903364202769, 0.136922606737311, 0.138012028037638,
> 0.136775934192342, 0.136172719004911, 0.136364919382056, 0.122106445616322,
> 0.121111651605594, 0.0962623729322267, 0.0981395485851856,
> 0.117961280078613, 0.114364914549088, 0.112811619226829, 0.1139844134944,
> 0.120975655704514, 0.117871553416396, 0.106136285136668, 0.106057886734732,
> 0.113735726997588, 0.108700010793231, 0.085947506860437,
> 0.0853823006923295, 0.0834373451373239, 0.0829486747947965,
>
> So, I lag my exon variable
> train.xreg = lag(train.vParkinson,1)
> train.test = as.matrix(train.xreg, ncol = 1)
>
> Then set a matrix, but I don’t think this is required as I am using xts
> class (see: https://stat.ethz.ch/pipermail/r-sig-finance/2014q3/012708.html)
>
> I have tried to change the class of train.vParkinson to matrix, data.frame,
> with the square brackets, without the square brackets, read several threads
> on a similar problem. What am I doing wrong?
>
> The data is extracted with quant mod:
> #     1.1.1 Set start and end date for collection in YYYYMMDD (numeric)
> format
> train.date.start<-19930103 #Monday
> train.date.end<-20090424 #Friday - changed the original date which was
> 20090427
>
>
> #     1.1.2 Collect historical data for DJIA Index
> train.djd <- getYahooData("^DJI", start=train.date.start,
> end=train.date.end, freq="daily")
> chartSeries(train.djd[,1:5])
>
> close.djdr = dailyReturn(djd[,4], type="log") #daily returns close on close
> close.djdr = close.djdr[-(1:9)]
>
> Thanks in advance.
> Kirro
>
> 	[[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