loading...

Using existing regression model for statistics

pmkroeker profile image Peter ・1 min read

Looking for some direction on this situation.

Previously, I have created OLS models using statsmodels. This works great and is easy to use when creating a new model from scratch.

Now, we have a new requirement to allow users to submit an existing equation (from a pre-existing model), to allow for comparison between the user submitted regression model and the statsmodels generated model. This comparison would ideally be able to be done looking at each models resulting ANOVA table.

I have looked at using r-style formula to set the existing equation, like so.

eq = 'y ~ 2.3(x) + 0.86(y) + 0.85(z) - 1786'
Enter fullscreen mode Exit fullscreen mode

This causes some issues with how statsmodels implemented the equation parsing, which uses patsy.

Basically I'm looking for a way to set a regression formula, and pass in data to generate stats about the model.

Possible solutions don't have to be in python.

Thanks in advance!

Discussion

pic
Editor guide