[R-SIG-Finance] Cointegration question.

Kent Hoxsey khoxsey at gmail.com
Sat Jun 15 16:15:42 CEST 2013


If you are looking for tools to identify trading pairs, you might start with Bryan Lewis' presentation from R-Finance 2012:

	http://www.rinfinance.com/agenda/2012/talk/BryanLewis.pdf

GL!

On Jun 15, 2013, at 5:30 AM, ganesha0701 wrote:

> Thanks for the inputs Marc. You provide some interesting insights. Yes,
> they are all prices. In my case the prices are very close to difference
> stationary actually. But none the less, any particular tool that you will
> recommend when it comes to testing for pairs trading. That is the ultimate
> application of interest, which is why I was interested in cointegration in
> the first place.
> 
> 
> On Sat, Jun 15, 2013 at 1:54 AM, Wildi Marc (wlmr) <wlmr at zhaw.ch> wrote:
> 
>> Ganesha, Brian, All
>> 
>> The log-return transformation typically eliminates trends of `prices' (the
>> latter should behave not too far away from a random-walk although we all
>> know that's not entirely true because otherwise this Mailing list wouldn't
>> exist).  Therefore the empirical significance Level of the ADF-test should
>> be markedly below 5% for log-Returns (except if there is/are shift(s) in
>> the transformed data!). The posted results (25%) strongly suggest Prices
>> (not log-Returns).
>> 
>> Cointegration: this is an econometrician tool developped for `stable'
>> (difference-stationary Gaussian) series which `behave well' over longer
>> time spans: Forget about application of this very sensitive stuff to
>> non-stationary financial data. Prices are not difference-stationary!
>> Econometrician are interested in the DGP (data generating process), not in
>> generating trading performances: therefore typical optimization criteria
>> are misleading: all statistics address one-step ahead mean-square
>> performances; who in the world (besides econometrician) is interested in
>> such a criterion?
>> 
>> My advice: skip this unreliable Topic and save some time for leisure!
>> 
>> Marc
>> 
>> ________________________________________
>> Von: r-sig-finance-bounces at r-project.org [
>> r-sig-finance-bounces at r-project.org]" im Auftrag von "Brian G.
>> Peterson [brian at braverock.com]
>> Gesendet: Freitag, 14. Juni 2013 18:14
>> An: r-sig-finance at r-project.org
>> Betreff: Re: [R-SIG-Finance] Cointegration question.
>> 
>> Please don't repost.  If someone has the answer to your question and
>> feels like helping, they will.
>> 
>> The most common problem we see in the list archives when questions like
>> this arise is that people are trying to test stationarity and
>> cointegration on prices rather than on returns.
>> 
>> However, you haven't actually provided reproducible data with your
>> partial code, so without that I'm just guessing.
>> 
>>  - Brian
>> 
>> On 06/14/2013 11:09 AM, ganesha0701 wrote:
>>> I have two time series that I am investigating, acc and amb, the time
>>> frequency is daily data. They are both non stationary, as evidenced by
>> the
>>> follows.
>>> 
>>> 
>>> 
>>> adf.test(df$acc)
>>> 
>>>         Augmented Dickey-Fuller Test
>>> 
>>> data:  df$acc
>>> Dickey-Fuller = -2.7741, Lag order = 5, p-value = 0.2519
>>> alternative hypothesis: stationary
>>> 
>>>> adf.test(df$amb)
>>> 
>>>         Augmented Dickey-Fuller Test
>>> 
>>> data:  df$amb
>>> Dickey-Fuller = -1.9339, Lag order = 5, p-value = 0.6038
>>> alternative hypothesis: stationary
>>> 
>>> I am looking to test for cointegration between the two time series but
>> the
>>> problem I am running into is that the cointegrating vector seems to
>> change
>>> in time.
>>> 
>>> 
>>> 1)* First 200 points*
>>> 
>>> ######################
>>> # Johansen-Procedure #
>>> ######################
>>> 
>>> Test type: maximal eigenvalue statistic (lambda max) , with linear trend
>>> 
>>> Eigenvalues (lambda):
>>> [1] 0.0501585398 0.0003129906
>>> 
>>> Values of teststatistic and critical values of test:
>>> 
>>>           test 10pct  5pct  1pct
>>> r <= 1 |  0.06  6.50  8.18 11.65
>>> r = 0  | 10.19 12.91 14.90 19.19
>>> 
>>> Eigenvectors, normalised to first column:
>>> (These are the cointegration relations)
>>> 
>>>            acc.l2    amb.l2
>>> acc.l2  1.0000000  1.000000
>>> amb.l2 -0.9610573 -2.237141
>>> 
>>> Weights W:
>>> (This is the loading matrix)
>>> 
>>>            acc.l2       amb.l2
>>> acc.d -0.03332428 -0.002576070
>>> amb.d  0.03986111 -0.001591227
>>> 
>>> 
>>> 2) *First 1000 points*
>>> 
>>> ######################
>>> # Johansen-Procedure #
>>> ######################
>>> 
>>> Test type: maximal eigenvalue statistic (lambda max) , with linear trend
>>> 
>>> Eigenvalues (lambda):
>>> [1] 0.019211132 0.001959403
>>> 
>>> Values of teststatistic and critical values of test:
>>> 
>>>           test 10pct  5pct  1pct
>>> r <= 1 |  1.96  6.50  8.18 11.65
>>> r = 0  | 19.36 12.91 14.90 19.19
>>> 
>>> Eigenvectors, normalised to first column:
>>> (These are the cointegration relations)
>>> 
>>>            acc.l2   amb.l2
>>> acc.l2  1.0000000  1.00000
>>> amb.l2 -0.8611314 15.76683
>>> 
>>> Weights W:
>>> (This is the loading matrix)
>>> 
>>>             acc.l2        amb.l2
>>> acc.d -0.008993595 -0.0002419353
>>> amb.d  0.027935684 -0.0002067523
>>> 
>>> 
>>> 3)* Whole History*
>>> 
>>> ######################
>>> # Johansen-Procedure #
>>> ######################
>>> 
>>> Test type: maximal eigenvalue statistic (lambda max) , with linear trend
>>> 
>>> Eigenvalues (lambda):
>>> [1] 0.0144066813 0.0008146258
>>> 
>>> Values of teststatistic and critical values of test:
>>> 
>>>           test 10pct  5pct  1pct
>>> r <= 1 |  1.16  6.50  8.18 11.65
>>> r = 0  | 20.64 12.91 14.90 19.19
>>> 
>>> Eigenvectors, normalised to first column:
>>> (These are the cointegration relations)
>>> 
>>>            acc.l2    amb.l2
>>> acc.l2  1.0000000   1.00000
>>> amb.l2 -0.8051537 -25.42806
>>> 
>>> Weights W:
>>> (This is the loading matrix)
>>> 
>>>            acc.l2       amb.l2
>>> acc.d -0.01003068 7.009487e-05
>>> amb.d  0.02128464 6.980209e-05
>>> 
>>> You can see the marginal change the coefficient values, from -0.96 to
>> -0.86
>>> to -0.80.
>>> 
>>> My question is how to interpret this, what is the optimal look back
>> period,
>>> what is the true relationship I should use for future prediction?
>>> 
>> 
>> _______________________________________________
>> 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.
>> 
> 
> 	[[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.



More information about the R-SIG-Finance mailing list