Regression functions and smoothed factors now available

I have not actually used this yet so I know I am not helping to answer Korr’s questions which are good questions. But, Yuval, nice spreadsheets (Google Sheets). Well organized and sum of squares Y-hat etc shows an in-depth understanding of what regressions are actually doing.

Korr, I had the same question at first. A little playing around and it was clear what I was looking for. In this example you are looking for predictable and consistent sales growth. Assume two companies have 9 years of total sales growth of 8% annually for a compounded total growth of 100%. But as you look at them, one had volatile sales where it was double one year and zero the next and everywhere in between. The second had year after year of 8% annualized sales growth. Looking at the simple sales growth number annualized the two would look the same. But with regression analysis you are not only looking at the upwards slope of the growth but looking at how much error around the mean there is. You can separate the two. Time and sales are the 2 variables. With each period, do sales go up predictably? Was the 9 years of growth expected based on previous period growth or was it an anomaly?

So this is really cool. And the last thing I would want is for the perfect to be the enemy of the good.

So not a criticism in any way and not a feature request either. That can also be sorted out later once we get a look at the AI.

But I don’t think I will use the time series aspect at all as the time-series data is not stationary. Just me though.

Here is something that I am sure the LinRegXY will be expanded to do when the AI comes out.

EV or price varies daily. Taking price for simplicity I would want to regress the SalesTTM/price ratio Monday AM before the open (the independent variable) and have the dependent variable be the return from Monday AM when the market opens (and after the SalesTTM/price ratio becomes available to P123 users) that day until Monday AM the next week’s open. So no look-ahead bias.

That is the potential holding period of that stock. I can buy it on the open (or mess around with limit orders) and get a signal from the port to sell it on the open (or hold) the following Monday. I can see an argument for using the close.

It would be nice to have that done automatically for all data points. At a minimum for all data points for that stock but really you want to do it for all stocks in the universe. You could also look at doing this for industries.

But that has to be where the AI is headed and with more (e.g., boosting). And with multiple regression too (not just one independent variable).

You would then just rank the stocks according to the expected return over the next week which is the dependent variable. Which stocks to buy becomes a sorting problem: buy the ones with the best expected return over the next week (which is your dependent variable).

I suspect this is a variation of what Korr was expecting and wondering about but I am sure he as other/additions interests.

And again, this is cool if (possibly) not finished.

@korr123 Not sure what I can add w/o repeating what’s in the Full Description (did you see it?) and the original announcement. The two main examples in the Full Description are the simplest use cases I came up with. One uses the regression of annual sales to find stocks that have good growth and latest annual was above the trend. The other finds stocks that had better EPS than what the Sales indicated. If there are simpler/better examples please let me know and I will add them.

@Jrinne Isn’t this what approx. what you want? The formula below regresses the past 20 weekly Pr2SalesTTM with the next week returns (open and close for the week). So not exactly what you want (open to open). I did a few spot checks looking at the Fundamental Chart and price series and things seem to line up.

LinRegXY(“FHist(`Pr2SalesTTM`,CTR+1)”, “Close_W(CTR)/Open_w(CTR)”, 20)

Marco,

Yes, I think so. Thank you for the coding help. So I think I would then rank EstimateY(0) in a ranking system if I am following?

This would be a rolling 20 week period and other look-backs could be added, if you decided to add them (e.g., going to the beginning of the data for each regression), And this does not have multiple regression yet I think. Meaning you could not also regress EBITDATTM/EV with price to sales in the same regression, maybe.

But yes that is what I was suggesting, I think. Thank you very much.

Best,

Jim

Yes EstimateY(0).

Trying to expand/modify LinReg functions to do more of the ML you are talking about would be very esoteric, hard to use, and error prone. I think most of the things you want will be doable with AI factors. LinReg functions were added to fill a hole we had, and mainly as a substitute for better growth/trend projections.

Marco,

Thank you. Very nice.

FWIW. I have something that is working nicely now already—that uses P123 great data and tools. I am very grateful for what you and everyone on staff at P123 are doing.

I am making an effort to only make suggestions for the growth of the platform with AI being something that I am interested in (and have done to some extent). I am no longer strongly tied to P123 implementing any particular idea of mine. What I do now works fine.

I will use your suggestions on coding for the linear regression function and that is very much appreciated.

Best,

Jim