Author Topic: Some questions on the statistics  (Read 2902 times)

Max Mayhew

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Some questions on the statistics
« on: May 25, 2017, 07:19:08 pm »
Hi Admin,

Just want to say first off, congrats, what a fantastic tool you have created and what a brilliant resource. I can only applaud you here, truly,

Secondly, I have some questions regarding clarification of some statistical terms; I have studied mathematics at University but never applied it to trading in this way, so if possible could I have clarification on the purpose of these tests and their significance? I apologise in advance if these seem very infant queries, but I have been searching the web for answers for days and am hoping you may be able to help!

1) Orthogonal regression (I can see regression co-efficient of alpha and beta, but why are these relevant?
What does the mean reversion co-efficient represent? What is the value we would want to see? And why the half life?)

2) What exactly is the autocorrelation PACF graph showing us (not understanding the 'lag' axis).

3) Engle Granger Co-integration test I understand, but why do we see the squared values of the regression, what should we be looking for here?


admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 274
  • Karma: +10/-0
    • Pair Trading Lab
Re: Some questions on the statistics
« Reply #1 on: May 29, 2017, 05:21:57 am »
Hello Max!

Thanks for nice words! Now, about your questions:

1) Orthogonal Regression - just presented as an additional layer of visualizing relationship between two instruments. The advantage is that the beta coefficient is the same (with flipped sign of the exponent) if you switch the order of both variables. Half-life is just an additional measure to see how fast the relation ship reverts to the mean. Orthogonal regression is not really used for pair trading - it is just an additional measure to explore the relationship. PTL analyses are not only used by pair traders, they are also used by students and university teachers (econometric, ...), who want to see these extra measures...

2) The PACF is just a visual indication of the amount of autocorrelation in the data. Autocorrelation above/below confidence intervals is non-random and invalidates cointegration results unless it is adjusted for by lagging the data and rerunning a
series of regressions. You can use PACF as an additional filter if you use correlation (ADF test). PACF result above confidence threshold may invalidate the whole ADF result...

3) R-Squared is provided as an additional measure. More info for instance here:
https://www.quora.com/What-is-cointegration-of-time-series-data-in-statistics
If you google for "cointegration r-squared" you will find even more resources.

Kind regards,
Karel

Max Mayhew

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Some questions on the statistics
« Reply #2 on: September 14, 2017, 10:41:53 am »
Hi Again!

Just another few questions (sorry):

1) What time frame is your backtesting facility used on (daily, 4hr, 1hr etc)?

2) When opening a position, I remember reading somewhere (perhaps here) that the open and close price of the trades are based solely on the open and close price of the assets traded? My question really is, are trades triggered intraday or only when the market opens and when the market closes?

Thank you in advance!

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 274
  • Karma: +10/-0
    • Pair Trading Lab
Re: Some questions on the statistics
« Reply #3 on: September 14, 2017, 03:51:57 pm »
Hello!

1) daily
2) stats (moving average, std dev) are determined using EOD close prices; signals to enter/exit are determined using real-time bid/ask prices (intraday)

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 274
  • Karma: +10/-0
    • Pair Trading Lab
Re: Some questions on the statistics
« Reply #4 on: September 14, 2017, 03:54:51 pm »
in addition to #2 - you can limit the time period where signals are evaluated (for instance - last 10 minutes before market close)

maybe this could be useful to you: https://www.pairtradinglab.com/faq#pairs-trading-eod-intraday

Max Mayhew

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Some questions on the statistics
« Reply #5 on: September 20, 2017, 09:34:14 am »
Legend!

Last question (I hope, sorry), if using 100% margin, how are the pair trade sizes calculated in a portfolio. I have calculated a portfolio of 3 pairs, one of those pairs is using 9k (of 100k) per trade, another pair is using 36k, what would be the rationale behind this?

Thanks

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 274
  • Karma: +10/-0
    • Pair Trading Lab
Re: Some questions on the statistics
« Reply #6 on: September 23, 2017, 12:28:56 pm »
Hello!

Margin allocation is explained here: https://wiki.pairtradinglab.com/wiki/Pair_Trading_Lab_Portfolios

If you think your portfolio is not set up correctly, please create a ticket in Helpdesk, describing the problem in detail (including the portfolio name), we will take a look!
Thanks!
Karel

Max Mayhew

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Some questions on the statistics
« Reply #7 on: September 26, 2017, 06:22:59 am »
Hi thank you
I have opened a ticket!

Max

Max Mayhew

  • Newbie
  • *
  • Posts: 6
  • Karma: +0/-0
Re: Some questions on the statistics
« Reply #8 on: September 29, 2017, 06:36:46 am »
Hi,

Quick question on the EOD and intraday:

You said "stats (moving average, std dev) are determined using EOD close prices; signals to enter/exit are determined using real-time bid/ask prices (intraday)".

Am I understanding that you use EOD to calculate things such as Z score etc, if a price at the EOD moves the Z score above an entry threshold, will your backtests enter the moment the market opens? If price has moved to a point where entry threshold is breached but the market is now closed because it is the EOD, when will it then trigger this trade?

Thank you!

admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 274
  • Karma: +10/-0
    • Pair Trading Lab
Re: Some questions on the statistics
« Reply #9 on: September 29, 2017, 09:07:46 am »
Hi,

for instance the Ratio model:
  • the moving average and standard deviation is calculated each day based on EOD prices
  • then the immediate Z-Score is calculated using the precomputed moving average, standard deviation AND real-time bid/ask prices