[R-SIG-Finance] How to output "Trace" list from auto.arima in forecast library
Joshua Ulrich
josh.m.ulrich at gmail.com
Mon Oct 3 16:28:01 CEST 2011
In addition to sink(), you can also use capture.output(). Then you
can read the contents of "out" into a new object.
out <- capture.output({
Fit <- auto.arima(data_ts, trace=TRUE)
})
outData <- read.table(con <- textConnection(out), sep=":")
close(con)
Best,
--
Joshua Ulrich | FOSS Trading: www.fosstrading.com
On Mon, Oct 3, 2011 at 7:36 AM, Jeffrey Ryan <jeffrey.ryan at lemnica.com> wrote:
> Take a look at ?sink
>
> The trace is just a series of calls to 'cat', so it won't be
> particularly useful unless you parse.
>
> Jeff
>
> On Mon, Oct 3, 2011 at 2:18 AM, Arun Krishnamoorthy
> <arun.k at bridgei2i.com> wrote:
>> Hi,
>> I'm working on the forecast library and am using the auto.arima function
>> with some dummy data
>>
>> Fit<-auto.arima(data_ts, trace=TRUE)
>>
>> I understand that trace evaluates alternative models and provides the
>> corresponding AIC/SIC values with an output that looks like this;
>>
>> ARIMA(2,1,2) with drift : 1278.988
>> ARIMA(0,1,0) with drift : 1281.161
>> ARIMA(1,1,0) with drift : 1280.325
>> ARIMA(0,1,1) with drift : 1278.2
>> ARIMA(1,1,1) with drift : 1280.229
>> ARIMA(0,1,2) with drift : 1278.824
>> ARIMA(1,1,2) with drift : 1281.911
>> ARIMA(0,1,1) : 1277.73
>> ARIMA(1,1,1) : 1279.804
>> ARIMA(0,1,0) : 1281.265
>> ARIMA(0,1,2) : 1278.626
>> ARIMA(1,1,2) : 1281.64
>>
>> Best model: ARIMA(0,1,1)
>>
>> Unfortunately, Trace is not an object and i'm unable to read it in to a data
>> frame to do further diagnosis.
>>
>> Can someone please help me with how i can get this output into a data frame.
>> I'm unable to do data.frame since i can't coerce an ARIMA object into this
>> class.
>>
>> Sorry if this has been addressed before. I just think there may be some data
>> series where running a closely competing alternative model may be useful
>>
>> Thanks,
>> AK
>>
>> -----Original Message-----
>> From: r-sig-finance-bounces at r-project.org
>> [mailto:r-sig-finance-bounces at r-project.org] On Behalf Of Daniel Cegielka
>> Sent: 26 September 2011 17:20
>> To: chrisbird
>> Cc: r-sig-finance at r-project.org
>> Subject: Re: [R-SIG-Finance] Filtering dates/times from zoo/xts series
>>
>> 2011/9/26 chrisbird <chris at chrisbird.com>
>>
>>> Thanks Brian,
>>>
>>> I did try using the ['T09:00/T21:00'] method for extraction but it did not
>>> return anything - I will reinvestigate this and see if I can get it
>>> working.
>>>
>>>
>> It works... you are sure that the data was ok? Very strange that you have
>> received nothing...
>>
>>> d<-xts(1:25, Sys.time() + 1:25)> d [,1]
>> 2011-09-26 13:26:55 1
>> 2011-09-26 13:26:56 2
>> 2011-09-26 13:26:57 3
>> 2011-09-26 13:26:58 4
>> 2011-09-26 13:26:59 5
>> 2011-09-26 13:27:00 6
>> 2011-09-26 13:27:01 7
>> 2011-09-26 13:27:02 8
>> 2011-09-26 13:27:03 9
>> 2011-09-26 13:27:04 10
>> 2011-09-26 13:27:05 11
>> 2011-09-26 13:27:06 12
>> 2011-09-26 13:27:07 13
>> 2011-09-26 13:27:08 14
>> 2011-09-26 13:27:09 15
>> 2011-09-26 13:27:10 16
>> 2011-09-26 13:27:11 17
>> 2011-09-26 13:27:12 18
>> 2011-09-26 13:27:13 19
>> 2011-09-26 13:27:14 20
>> 2011-09-26 13:27:15 21
>> 2011-09-26 13:27:16 22
>> 2011-09-26 13:27:17 23
>> 2011-09-26 13:27:18 24
>> 2011-09-26 13:27:19 25> d["2011-09-26 13:27:00/2011-09-26 13:27:10"]
>> [,1]
>> 2011-09-26 13:27:00 6
>> 2011-09-26 13:27:01 7
>> 2011-09-26 13:27:02 8
>> 2011-09-26 13:27:03 9
>> 2011-09-26 13:27:04 10
>> 2011-09-26 13:27:05 11
>> 2011-09-26 13:27:06 12
>> 2011-09-26 13:27:07 13
>> 2011-09-26 13:27:08 14
>> 2011-09-26 13:27:09 15
>> 2011-09-26 13:27:10 16> d["T13:27:00/T13:27:10"] [,1]
>> 2011-09-26 13:27:00 6
>> 2011-09-26 13:27:01 7
>> 2011-09-26 13:27:02 8
>> 2011-09-26 13:27:03 9
>> 2011-09-26 13:27:04 10
>> 2011-09-26 13:27:05 11
>> 2011-09-26 13:27:06 12
>> 2011-09-26 13:27:07 13
>> 2011-09-26 13:27:08 14
>> 2011-09-26 13:27:09 15
>> 2011-09-26 13:27:10 16
>>
>>
>>
>>
>>> The processing is not to remove non-trading days/holidays - I do that
>>> elsewhere. I'm doing processing on some complex strategies which use some
>>> instruments which trade a lot, but not everyday. I only wish to process
>> the
>>> data from liquid days and strip out the less liquid data.
>>>
>>>
>> It's quite a sophisticated approach to data. Probably when you filter using
>> the time you would have to count the number of observations and does not
>> bind data below a certain level. I have no idea how to do it in an elegant
>> way.
>>
>> best regards,
>> daniel
>>
>>
>>
>>> I will certainly investigate quantstrat.
>>>
>>> Thanks,
>>>
>>> Chris.
>>>
>>>
>>> --
>>> View this message in context:
>>>
>> http://r.789695.n4.nabble.com/Filtering-dates-times-from-zoo-xts-series-tp38
>> 42937p3843408.html
>>> Sent from the Rmetrics mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> 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.
>>>
>>
>> [[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.
>>
>> _______________________________________________
>> 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.
>>
>
>
>
> --
> Jeffrey Ryan
> jeffrey.ryan at lemnica.com
>
> www.lemnica.com
> www.esotericR.com
>
> _______________________________________________
> 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