[R-SIG-Finance] Aligning time series
David Reiner
David.Reiner at xrtrading.com
Wed Apr 16 16:26:07 CEST 2014
Definitely use xts !
For Question 2, I would merge all, leaving NA's for missing data.
Then what you do next depends on what you are trying to accomplish,
but sometimes LOCF can be appropriate,
for example if these are trades for less liquid instruments.
However, you may need to do some hard thinking about which of the many ways of dealing with missing data would be best for your specific task.
David L. Reiner, Ph.D.
Head Quant
XR Trading LLC
PS: better to post in plain text rather than html.
-----Original Message-----
From: r-sig-finance-bounces at r-project.org [mailto:r-sig-finance-bounces at r-project.org] On Behalf Of Chirag Anand
Sent: Wednesday, April 16, 2014 1:13 AM
To: r-sig-finance at r-project.org
Subject: Re: [R-SIG-Finance] Aligning time series
Hi Mikhail,
As Ilya said, xts takes care of it. You can use "merge.zoo" (if using
zoo) or "merge.xts" to merge two series. The missing timestamps are
taken care of by the "all" argument. You can use it to specify whether
to take missing timestamps from both the series, an individual series,
or not at all. The details are available in the respective man pages
of the functions.
On 16 April 2014 00:39, Ilya Kipnis <ilya.kipnis at gmail.com> wrote:
> Mikhail, are you using the xts package? Because when you cbind two xts time
> series, it takes care of alignment for you.
>
> -Ilya
>
>
> On Tue, Apr 15, 2014 at 12:07 PM, Mikhail Beketov <
> mikhailbeketov at googlemail.com> wrote:
>
>> Hello,
>> I have to analyze a large data-set of 1-min stock prices. The problem is
>> that the time-series for different stocks in my data-set have different
>> length, as some time points are missing in one series but present in
>> another etc. So, I have to create a table with aligned time series (all
>> dates/times should correspond to all the stocks). My questions are:
>> 1) Is there some efficient way to do it? Is there anything that is already
>> programmed.
>> 2) Does it make sense to align all of them to shortest time series (so,
>> delete the time points that are not given for all stocks)? Or, is better to
>> copy the preceding price values for the absent time points, and therefore
>> to align all of them to the longest time series?
>> Thanks,
>> Michael
>>
>> [[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.
>>
>
> [[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.
--
Chirag Anand
http://atvariance.in/chiraganand
_______________________________________________
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.
This e-mail and any materials attached hereto, including, without limitation, all content hereof and thereof (collectively, "XR Content") are confidential and proprietary to XR Trading, LLC ("XR") and/or its affiliates, and are protected by intellectual property laws. Without the prior written consent of XR, the XR Content may not (i) be disclosed to any third party or (ii) be reproduced or otherwise used by anyone other than current employees of XR or its affiliates, on behalf of XR or its affiliates.
THE XR CONTENT IS PROVIDED AS IS, WITHOUT REPRESENTATIONS OR WARRANTIES OF ANY KIND. TO THE MAXIMUM EXTENT PERMISSIBLE UNDER APPLICABLE LAW, XR HEREBY DISCLAIMS ANY AND ALL WARRANTIES, EXPRESS AND IMPLIED, RELATING TO THE XR CONTENT, AND NEITHER XR NOR ANY OF ITS AFFILIATES SHALL IN ANY EVENT BE LIABLE FOR ANY DAMAGES OF ANY NATURE WHATSOEVER, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL AND PUNITIVE DAMAGES, LOSS OF PROFITS AND TRADING LOSSES, RESULTING FROM ANY PERSON'S USE OR RELIANCE UPON, OR INABILITY TO USE, ANY XR CONTENT, EVEN IF XR IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES OR IF SUCH DAMAGES WERE FORESEEABLE.
More information about the R-SIG-Finance
mailing list