Back

Something beyonf my current scope - Statistical calculations

Hello,

I am trying following - 

  1. Calculate exponential regression for x number of days (125 and 250 days) - NOT SURE
  2. Calculate r squared value (Wiki details) - NOT SURE
  3. Then I will try to calculate based on these values the best portfolio to create - CAN BE HANDLED
  4. I would like to calculate the Exp regression * r squared for both 125 and 250 days - EASY TO HANDLE
  5. Finally find a ratio for this - 125/250d values - CAN BE HANDLED
  6. Now there are some other checks which are doable - CAN BE HANDLED
Questions
  1. Any direct functions I can use? I saw LSMA but not sure if it is the exponential regression from point 1 above.
  2. I know the calculations but currently no clue how to calculate this value hopefully with an inbuilt function. I found this function and also that Quantconnect supports it -  link. But I am not able to exactly figure out who to do it.
What I am seeking help 
  1. Can you confirm my question 1 if LSMA is same
  2. Can you help me calculate r squared value or point me to some example which can do this?
Thank you for your helpRay
Update Backtest







0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


When I mark it as NOT SURE, it means I don't know how to do it

When I mark as CAN BE HANDLED, I can do it I think, just to clarify  :) 

0

Hi Ray,

The LSMA indicator doesn't utilize exponential regression to compute its indicator value, it uses linear regression. See the source code here. For convenience, I've attached a research notebook that demonstrates how we can fit an exponential regression model to sample data and calculate the R2 value.

Best,
Derek Melchin

0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed