[R-SIG-Finance] [rugarch] ugarchroll returns objects structures differently

Alexios Ghalanos alexios at 4dscape.com
Sat Nov 8 20:09:35 CET 2014


I think I see what you mean. There is a reason why the non-converged object has a slightly different structure that the converged one since it is 'designed' in such a way as to facilitate the use of the resume method. I had not considered that one would want to obtain an object with non converged estimation windows. I'll consider extending the extractors to return the density even when not all windows are converged (and probably replace the as.data.frame method with an as.xts method)...when I find some time.

Alexios

> On 8 Nov 2014, at 18:48, Ivan Popivanov <ivan.popivanov at gmail.com> wrote:
> 
> A short repro may take me a while (gotta fine a spot in the series where it's quick to get a failure). If it helps, you may want to take a look at the two attached objects. They are BOTH the results returned from ugarchroll. Run the following:
> 
> env = new.env()
> load("bb.RData", envir=env)
> load("cc.RData", envir=env)
> # Let's get the forecasts. The first call is fine. The second - not so.
> as.data.frame(env$cc, "density")
> as.data.frame(env$bb, "density")
> 
> Both are ugarchroll on the GSPC returns, the failing one is something lie:
> 
> getSymbols("^GSPC", from="1900-01-01")
> gspc.rets = ROC(Cl(GSPC), na.pad=F)
> spec = ugarchspec(variance.model=list(garchOrder=c(1,1), model="sGARCH"),mean.model=list(armaOrder=c(0,1)), distribution.model="sged")
> bb = ugarchroll(spec, gspc.rets, n.ahead=1, n.start=500, refit.every=1, refit.window="moving", window.size=500, cluster=makeCluster(6))
> 
> It takes some time (about an hour) to finish.
> 
> Regards,
> Ivan
> 
> 
>> On Sat Nov 08 2014 at 12:40:02 alexios ghalanos <alexios at 4dscape.com> wrote:
>> Here are some hints:
>> 
>> 1. The non-converged entries can be found in:
>>  >roll at model$noncidx
>> 2. If you want to try and obtain a fully converged object before
>> extracting the data use the 'resume' method on the returned object:
>>  >resume(roll, ....)
>> Where "..." allows a number of options (i.e. try solver="gosolnp" or
>> even an alternative specification).
>> 
>> I'm not sure what you mean when you say your routine fail to deal with
>> the different format "coming from the first scenario".
>> 
>> As regards a uniform approach, I don't see how the results obtained from
>> the call to method "as.data.frame(roll)" are NOT uniform. If you have
>> followed the documentation and used xts, then you will get uniform
>> "looking" results as far as I've checked (...but not fully for the
>> intraday data case). Beyond that, I really can comment without a
>> MINIMALLY reproducible example.
>> 
>> Alexios
>> 
>> On 08/11/2014 17:24, Ivan Popivanov wrote:
>> > Hello,
>> >
>> > The problem I am facing seems to come down to two different scenarios. The
>> > first scenario is a short, 15 steps. The second is long - about 15,000.
>> >
>> > In the first cases all fits are successful, and the result contains (in
>> > roll at forecast$density) a data frame.
>> >
>> > In the second case, there were some failed fits. Now, roll at forecast is a
>> > list with 15,000 entries (the number of forecasts) and each of them
>> > contains a few slots. The slot which is set for all is "converge". Since
>> > there are failed fits (some "converge" == FALSE), as.data.frame(roll,
>> > "density") fails. Thus, I wrote my own routine to extract the data (by
>> > walking the list), but my routine fails to deal with the different format
>> > coming from the the first scenario.
>> >
>> > My feeling is that there should be a uniform way to get the forecasts (if
>> > it failed date+NA in the data.frame) OR a uniform format of the results.
>> >
>> > Let me know if you need a repro.
>> >
>> > Thanks in advance,
>> > Ivan
>> >
>> >       [[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.
>> >
>> >
>> 
> <cc.RData>
> <bb.RData>

	[[alternative HTML version deleted]]



More information about the R-SIG-Finance mailing list