[R-SIG-Finance] why my rugarch ugarchfit function is slow ?

alexios ghalanos alexios at 4dscape.com
Fri Jul 5 18:08:51 CEST 2013


Yes it is slow because the fractional parameter is estimated by ML using 
a truncation lag of about 1000 (there are quicker methods but this is 
the method used by rugarch for the joint ARFIMA-GARCH estimation...and 
it just carries over to the
ARFIMA-non GARCH model). The autoarfima function provides the option of
passing a cluster object (from the parallel package) in order to 
evaluate the models in parallel (but you probably already knew this as 
it is documented).

-Alexios

On 05/07/2013 15:04, ce wrote:
> Hi Alexios,
>
> One more request. Are those execution times are normal ?
>
>> system.time(autoarfima(data = sp500ret, ar.max = 2, ma.max = 2, arfima=TRUE, criterion = "AIC", method = "full"))
>     user  system elapsed
>   484.99    0.02  487.62
>> system.time(autoarfima(data = sp500ret, ar.max = 2, ma.max = 2, criterion = "AIC", method = "full"))
>     user  system elapsed
>    13.71    0.02   13.74
>
>   arfima=TRUE option makes autoarfima very slow ?
>
>
> -----Original Message-----
> From: "alexios ghalanos" [alexios at 4dscape.com]
> Date: 07/04/2013 04:23 AM
> To: "ce" <zadig_1 at excite.com>
> CC: "" <alexios at 4dscape.com>, "" <r-sig-finance at r-project.org>
> Subject: Re: [R-SIG-Finance] why my rugarch ugarchfit function is slow ?
>
> Hi,
>
> I took out an old laptop from storage runnnig Mint x46 on an Intel Core
> 2 (older than the 'i's) and was able to reproduce the problem with
> rugarch 1.2-5. However, on updating to the newest release on google code
> (1.2-6) I got:
>
> spec = ugarchspec(variance.model = list(model = 'fGARCH',submodel =
> 'NAGARCH', garchOrder = c(2, 1)), distribution = 'sstd')
> system.time(ugarchfit(spec, sp500ret, solver = 'hybrid'))
>    user  system elapsed
>    11.412   0.052  11.470
>
> This is "likely" related to a reversal of a change made in a previous
> version for vectorizing distributions (and affecting among other things
> the stationarity constraint, but not the likelihood
> evaluation as this is in any case evaluated in C). Make sure you get the
> newest version from its google code repository and that you are in fact
> installing it.
>
> Regards,
>
> Alexios
>
> On 07/04/2013 10:22 AM, ce wrote:
>> Hi Alexios,
>>
>> Thanks for the advise, I was just testing different options and wasting my CPU cycles.
>> Re-installing R and rugarch didn't help.
>> You should have a super computer I guess, I did the same test on a dell laptop i5 cpu 64 bit windows 7, 4GB memory,  results are :
>>> library("rugarch")
>> Loading required package: Rcpp
>> Loading required package: RcppArmadillo
>> Package Rsolnp (1.14) loaded.  To cite, see citation("Rsolnp")
>>
>> KernSmooth 2.23 loaded
>> Copyright M. P. Wand 1997-2009
>>
>>> data(sp500ret)
>>> spec = ugarchspec(variance.model = list(model = 'fGARCH',submodel = 'NAGARCH', garchOrder = c(2, 1)), distribution = 'sstd')
>>>    system.time(ugarchfit(spec, sp500ret, solver = 'hybrid'))
>>      user  system elapsed
>>     78.45    0.08   79.30
>>
>>> mydata = c(0.082642875,-0.854761542,-0.077033376,0.406766344,-0.158930181,0.221923295,0.142042082,0.197391055,-0.109232737,-0.139228622,-0.121972401,-0.153521155,-0.046589943,-0.145470513,0.219578485,0.043333125,-0.034798222,-0.162685582,-0.053049221,0.207199901,-0.224930862,0.022989518,-0.028370697,0.010733556,0.065427805,-0.065427805,-0.355150941,-0.065554265,0.239806124,-0.054778206,0.203124684,-0.035550984,0.090971778,-0.033601747,0.066111025,0.029852963,0.030573580,-0.060426543,-0.160342650,0.170392986,0.000000000,-0.133531393,0.011363759,0.345311185,-0.057629113,0.083946421,0.165954579,0.038839833,-0.078104552,-0.088468648,0.117783036,0.074901308,0.002059733,0.066658187,0.038702329,0.211970251,0.016345089,-0.076548451,-0.367989997,-0.067762102,-0.016119382,0.148420005,-0.154689618,-0.213753811,-0.117199094,0.019081238,-0.097374164,0.255933374,0.353296810,0.132887519,-0.044246849,0.098646225,0.067682591,-0.066828985,0.241405811,0.032962773,0.067695013,0.050232125,0.09294952
3,-0.284186788,0.024811748,0.020883211,-0.112795494,0.317639288,0.072787942,0.113058086,0.120935481,0.017040238,-0.011857846,-0.027410019,-0.211765940,-0.054488185,-0.268140917,0.034273403,-0.098347132,0.040078224,-0.010772097,0.000000000,0.000000000,0.000000000,0.000000000,0.537189816)
>>>
>>> system.time(ugarchfit(spec, mydata, solver = 'hybrid'))
>>      user  system elapsed
>>    218.46    0.18  233.61
>>
>>
>> -----Original Message-----
>> From: "alexios ghalanos" [alexios at 4dscape.com]
>> Date: 07/02/2013 05:37 PM
>> To: "ce" <zadig_1 at excite.com>
>> CC: "" <r-sig-finance at r-project.org>
>> Subject: Re: [R-SIG-Finance] why my rugarch ugarchfit function is slow ?
>>
>> No idea.
>>
>> I get:
>>
>> system.time(ugarchfit(spec, sp500ret,  solver = 'hybrid'))
>> user  system elapsed
>> 9.66    0.01    9.67
>>
>> system.time(ugarchfit(spec, mydata,  solver = 'hybrid'))
>> user  system elapsed
>> 5.74    0.00    5.73
>>
>> Make sure you've updated all packages used (rugarch from the google
>> repository).
>>
>> You have also chosen to ignore numerous warnings in previous posts to
>> this forum about using such a small amount of data, and have in addition
>> gone and added a nonlinear GARCH(2,1) model with the sstd distribution.
>> I hope you are not using the results for anything other
>> than filling up empty space on your hard disk.
>>
>> -Alexios
>>
>> On 02/07/2013 21:44, ce wrote:
>>> Hi,
>>>
>>> I use R 3.0.1, opensuse 12.3 on a sony vaio i3 cpu.  When I use sp500ret data (5523 values) coming from rugarch package, ugarchfit performance is acceptable, but my data has only 102 values, why it takes much longer?
>>>
>>>> R
>>> R version 3.0.1 (2013-05-16) -- "Good Sport"
>>> Copyright (C) 2013 The R Foundation for Statistical Computing
>>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>>
>>>> library("rugarch")
>>> Loading required package: Rcpp
>>> Loading required package: RcppArmadillo
>>> Package Rsolnp (1.14) loaded.  To cite, see citation("Rsolnp")
>>>
>>> KernSmooth 2.23 loaded
>>> Copyright M. P. Wand 1997-2009
>>>
>>>> data(sp500ret)
>>>> dim(sp500ret)
>>> [1] 5523    1
>>>
>>>> spec = ugarchspec(variance.model = list(model = 'fGARCH',submodel = 'NAGARCH', garchOrder = c(2, 1)), distribution = 'sstd')
>>>> system.time(ugarchfit(spec, sp500ret,  solver = 'hybrid'))
>>>       user  system elapsed
>>> 141.562   0.136 142.448
>>>
>>>> mydata = c(0.082642875,-0.854761542,-0.077033376,0.406766344,-0.158930181,0.221923295,0.142042082,0.197391055,-0.109232737,-0.139228622,-0.121972401,-0.153521155,-0.046589943,-0.145470513,0.219578485,0.043333125,-0.034798222,-0.162685582,-0.053049221,0.207199901,-0.224930862,0.022989518,-0.028370697,0.010733556,0.065427805,-0.065427805,-0.355150941,-0.065554265,0.239806124,-0.054778206,0.203124684,-0.035550984,0.090971778,-0.033601747,0.066111025,0.029852963,0.030573580,-0.060426543,-0.160342650,0.170392986,0.000000000,-0.133531393,0.011363759,0.345311185,-0.057629113,0.083946421,0.165954579,0.038839833,-0.078104552,-0.088468648,0.117783036,0.074901308,0.002059733,0.066658187,0.038702329,0.211970251,0.016345089,-0.076548451,-0.367989997,-0.067762102,-0.016119382,0.148420005,-0.154689618,-0.213753811,-0.117199094,0.019081238,-0.097374164,0.255933374,0.353296810,0.132887519,-0.044246849,0.098646225,0.067682591,-0.066828985,0.241405811,0.032962773,0.067695013,0.050232125,0.09!
>>>     2949523,-0.284186788,0.024811748,0.020883211,-0.112795494,0.317639288,0.072787942,0.113058086,0.120935481,0.017040238,-0.011857846,-0.027410019,-0.211765940,-0.054488185,-0.268140917,0.034273403,-0.098347132,0.040078224,-0.010772097,0.000000000,0.000000000,0.000000000,0.000000000,0.537189816)
>>>
>>>> system.time(ugarchfit(spec, mydata,  solver = 'hybrid'))
>>>       user  system elapsed
>>> 367.052   0.298 369.194
>>> _______________________________________________
>>> 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