Quantile regression-ValueError: operands could not be broadcast together with shapes ...

78 views
Skip to first unread message

Maryam Sami

unread,
Dec 14, 2022, 1:37:37 PM12/14/22
to pystatsmodels
Hi,

I am trying to fit a quantile regression model to a number of  independent variables. Let's say that one of the independent variables that I definitely want to include is 'x'.  The problem is I can fit the model with 'x' and at most one other independent variable but as soon as I drop 'x' or try to fit any other model without 'x' I get this value error

diff = np.max(np.abs(beta - beta0))

ValueError: operands could not be broadcast together with shapes (3,) (2,)

Thanks for your help
Maryam 

josef...@gmail.com

unread,
Dec 14, 2022, 2:30:55 PM12/14/22
to pystat...@googlegroups.com
This might be https://github.com/statsmodels/statsmodels/issues/2597
if exog is singular.
However that was supposed to be fixed.

Is your statsmodels version older than 0.13?

Check if your x matrix is singular, for example, np.linalg.matrix_rank(x) should be equal to the number of columns.

Josef

--
You received this message because you are subscribed to the Google Groups "pystatsmodels" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pystatsmodel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pystatsmodels/642327bd-9a6f-432c-9eef-9352571ab4fcn%40googlegroups.com.

Maryam Sami

unread,
Dec 14, 2022, 2:53:35 PM12/14/22
to pystatsmodels
Thanks Josef, the problem was the old version.
Reply all
Reply to author
Forward
0 new messages