Any systematic way in R of doing this?
Thanks a lot! |
Michael Jungle wrote:
> Any systematic way in R of doing this? [find lead-lag relation in two time series?] > Lots of them. What theory of lead-lag relationships are you trying to replicate? On what type of data? (those are important inputs to answering what tools are available)) - Brian -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock _______________________________________________ [hidden email] 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. |
In reply to this post by Michael Jungle
One possibility is to do the cross-correlation.
What series shall I apply cross-correlation to? Price or return series? If I do cross-correlation on two price series, and found some large correlation numbers, and then do cross-correlation on two return series, and found no significant numbers(almost zero), What does that mean? |
In reply to this post by Michael Jungle
The standard approach is to estimate a vector autoregression involving your
variables of interest and then test for Granger non-causality. See the vars package and in particular the causality() function. Eric Zivot Professor and Gary Waterman Distinguished Scholar Department of Economics Adjunct Professor of Finance Adjunct Professor of Statistics Box 353330 email: [hidden email] University of Washington phone: 206-543-6715 Seattle, WA 98195-3330 www: http://faculty.washington.edu/ezivot -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael Jungle Sent: Friday, February 19, 2010 2:47 PM To: [hidden email] Subject: [R-SIG-Finance] How to find lead-lag relation in two time series? Any systematic way in R of doing this? Thanks a lot! -- View this message in context: http://n4.nabble.com/How-to-find-lead-lag-relation-in-two-time-series-tp1562 347p1562347.html Sent from the Rmetrics mailing list archive at Nabble.com. _______________________________________________ [hidden email] 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. _______________________________________________ [hidden email] 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. |
In reply to this post by Michael Jungle
You want to use returns, not prices.
Correlations with prices are spurious. (The extreme example is to think of a long set of series with inflation -- all the price series will be positively correlated.) On 19/02/2010 23:15, Michael Jungle wrote: > > One possibility is to do the cross-correlation. > > What series shall I apply cross-correlation to? Price or return series? > > If I do cross-correlation on two price series, and found some large > correlation numbers, > > and then do cross-correlation on two return series, and found no significant > numbers(almost zero), > > What does that mean? -- Patrick Burns [hidden email] http://www.burns-stat.com _______________________________________________ [hidden email] 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. |
For lead and lags cross-correlation:
cc<-ccf(mdeaths, fdeaths,lag.max=4, plot=F) cc #but this function is rather ugly... Patrick Burns a écrit : > You want to use returns, not prices. > Correlations with prices are spurious. > (The extreme example is to think of > a long set of series with inflation -- > all the price series will be positively > correlated.) > > > On 19/02/2010 23:15, Michael Jungle wrote: >> >> One possibility is to do the cross-correlation. >> >> What series shall I apply cross-correlation to? Price or return series? >> >> If I do cross-correlation on two price series, and found some large >> correlation numbers, >> >> and then do cross-correlation on two return series, and found no >> significant >> numbers(almost zero), >> >> What does that mean? > _______________________________________________ [hidden email] 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. |
In reply to this post by Patrick Burns-2
Thx but why? I want buy/short based on price correlations right? Not returns...
On Saturday, February 20, 2010, Patrick Burns-2 [via R] <[hidden email]> wrote: > > > You want to use returns, not prices. > > Correlations with prices are spurious. > > (The extreme example is to think of > > a long set of series with inflation -- > > all the price series will be positively > > correlated.) > > > > On 19/02/2010 23:15, Michael Jungle wrote: > >> > >> One possibility is to do the cross-correlation. > >> > >> What series shall I apply cross-correlation to? Price or return series? > >> > >> If I do cross-correlation on two price series, and found some large > >> correlation numbers, > >> > >> and then do cross-correlation on two return series, and found no significant > >> numbers(almost zero), > >> > >> What does that mean? > > -- > > Patrick Burns > > [hidden email] <http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1562668&i=0> > > http://www.burns-stat.com > > _______________________________________________ > > [hidden email] <http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1562668&i=1> 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. > > > > > View message @ http://n4.nabble.com/How-to-find-lead-lag-relation-in-two-time-series-tp1562347p1562668.html > > > To unsubscribe from Re: How to find lead-lag relation in two time series?, click here <http://n4.nabble.com/subscriptions/Unsubscribe.jtp?code=bWljaGFlbC5pbi50aGUuanVuZ2xlQGdtYWlsLmNvbXwxNTYyMzgzfDE5MDI3MzExNzk=>. > > > |
Price time series will usually have a positive drift and thus are
non-stationary. As far as I know most methods of time series analysis deal with stationary series and if you want to analyze a non-stationary series, you should transform the series and obtain a stationary version of the raw data first. Return time series are usually (or at least assumed to be) stationary and thus your focus should lie on returns rather than prices.. Hth Thomas Michael Jungle schrieb: > Thx but why? I want buy/short based on price correlations right? Not returns... > > On Saturday, February 20, 2010, Patrick Burns-2 [via R] > <[hidden email]> wrote: > >> You want to use returns, not prices. >> >> Correlations with prices are spurious. >> >> (The extreme example is to think of >> >> a long set of series with inflation -- >> >> all the price series will be positively >> >> correlated.) >> >> >> >> On 19/02/2010 23:15, Michael Jungle wrote: >> >> >>> One possibility is to do the cross-correlation. >>> >>> What series shall I apply cross-correlation to? Price or return series? >>> >>> If I do cross-correlation on two price series, and found some large >>> >>> correlation numbers, >>> >>> and then do cross-correlation on two return series, and found no significant >>> >>> numbers(almost zero), >>> >>> What does that mean? >>> >> -- >> >> Patrick Burns >> >> [hidden email]Â <http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1562668&i=0> >> >> http://www.burns-stat.com >> >> _______________________________________________ >> >> [hidden email]Â <http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1562668&i=1> 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. >> >> >> >> >> View message @ http://n4.nabble.com/How-to-find-lead-lag-relation-in-two-time-series-tp1562347p1562668.html >> >> >> To unsubscribe from Re: How to find lead-lag relation in two time series?, click hereÂ < (link removed) =>. >> >> >> >> > > > ------------------------------------------------------------------------ > > _______________________________________________ > [hidden email] 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. _______________________________________________ [hidden email] 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. |
Thomas is right. One should never measure correlations based on prices-
it always leads to hugely inflated absolute correlations. It is not uncommon for beginners to take correlations of prices and find, to their delight, that correlations are as high as 70-90% on some assets. Then, when they try to use spread option strategies to take advantage of the tight correlations, they find that their strategies break down because the actual correlations are only about 30-40%. On Sat, 2010-02-20 at 18:30 +0100, Thomas Etheber wrote: > Price time series will usually have a positive drift and thus are > non-stationary. > As far as I know most methods of time series analysis deal with > stationary series and if you want to analyze a non-stationary series, > you should transform the series and obtain a stationary version of the > raw data first. > Return time series are usually (or at least assumed to be) stationary > and thus your focus should lie on returns rather than prices.. > > Hth > Thomas > > > > Michael Jungle schrieb: > > Thx but why? I want buy/short based on price correlations right? Not returns... > > > > On Saturday, February 20, 2010, Patrick Burns-2 [via R] > > <[hidden email]> wrote: > > > >> You want to use returns, not prices. > >> > >> Correlations with prices are spurious. > >> > >> (The extreme example is to think of > >> > >> a long set of series with inflation -- > >> > >> all the price series will be positively > >> > >> correlated.) > >> > >> > >> > >> On 19/02/2010 23:15, Michael Jungle wrote: > >> > >> > >>> One possibility is to do the cross-correlation. > >>> > >>> What series shall I apply cross-correlation to? Price or return series? > >>> > >>> If I do cross-correlation on two price series, and found some large > >>> > >>> correlation numbers, > >>> > >>> and then do cross-correlation on two return series, and found no significant > >>> > >>> numbers(almost zero), > >>> > >>> What does that mean? > >>> > >> -- > >> > >> Patrick Burns > >> > >> [hidden email]Ã <http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1562668&i=0> > >> > >> http://www.burns-stat.com > >> > >> _______________________________________________ > >> > >> [hidden email]Ã <http://n4.nabble.com/user/SendEmail.jtp?type=node&node=1562668&i=1> 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. > >> > >> > >> > >> > >> View message @ http://n4.nabble.com/How-to-find-lead-lag-relation-in-two-time-series-tp1562347p1562668.html > >> > >> > >> To unsubscribe from Re: How to find lead-lag relation in two time series?, click hereÃ < (link removed) =>. > >> > >> > >> > >> > > > > > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > [hidden email] 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. > > _______________________________________________ > [hidden email] 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]] _______________________________________________ [hidden email] 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. |
But we trade on prices, right? How do you trade on returns?
My preliminary understanding is "whatever we trade on, we should find correlation, etc. there...". If you find lead-lag relations on returns, how do you trade them? |
Michael Jungle wrote:
> But we trade on prices, right? How do you trade on returns? > > My preliminary understanding is "whatever we trade on, we should find > correlation, etc. there...". > > If you find lead-lag relations on returns, how do you trade them? > You've already been given the answer. Correlations on prices produce spurious results. Go do some research. The literature will agree with what you've been told here. Returns may be turned back into prices (or more appropriately, a wealth index) - Brian -- Brian G. Peterson http://braverock.com/brian/ Ph: 773-459-4973 IM: bgpbraverock _______________________________________________ [hidden email] 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. |
What Brian wrote. A good place to start is John C. Hull's "Bible"-
"Options, Futures, & Other Derivatives". Start with Ch. 13 and go from there. On Mon, 2010-02-22 at 15:13 -0600, Brian G. Peterson wrote: > Michael Jungle wrote: > > But we trade on prices, right? How do you trade on returns? > > > > My preliminary understanding is "whatever we trade on, we should find > > correlation, etc. there...". > > > > If you find lead-lag relations on returns, how do you trade them? > > > You've already been given the answer. > > Correlations on prices produce spurious results. > > Go do some research. The literature will agree with what you've been > told here. > > Returns may be turned back into prices (or more appropriately, a wealth > index) > > - Brian > [[alternative HTML version deleted]] _______________________________________________ [hidden email] 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. |
Powered by Nabble | Edit this page |