DEV Community

Peter
Peter

Posted on

Using existing regression model for statistics

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!

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay