Skip to content
Advertisement

How to fix the error: ValueError: endog and exog matrices are different sizes

I’m trying to write a program in python that uses a query in SQL to collect data and make a regression model. When I try to actually create the model, however, it gives me this error.

I’m pretty sure that I know what is going wrong, but I have no idea how to fix it. I’ve tried several things already, but none so far have worked.

Advertisement

Answer

I figured out what was going wrong. It was a little bit about how I had written my x and y values, and I had to get rid of my constant variable:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement