You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like R is dropping some variables here or something? The R results indicate NaNs in the regression, and we don't match the results. See my comments there.
GLM uses WLS with uses pinv and should be robust (most likely) to singular exog, but will pick "some" solution.
If it's really singular, then we don't need to match the params, we only need to match fittedvalues, if there are different ways of handling singular matrices. We pinv, Stata drops variables, patsy might drop columns, no idea what R does. discrete_model breaks with default optimizer newton.
Yeah I have no idea what R's doing there. I didn't get into it. Just noticed that we're having "problems" on this textbook example. I think it's a poor model, but I'd like to dig in a little more.
Having patsy do the multicollinearity handling for us seems nice, but also potential for more duplicate code when we don't go through patsy.
my guess is that patsy handles only perfect multicollinearity, like dropping a level of a categorical variable (in an interaction term) if there are no observations for it.
patsy shouldn't decide and drop in the case of almost perfect collinearity (eigenvalue 1e-xxx).
try fit_regularized on the example, that needs more advertising.
Has anybody thought of how to deal with near-perfect collinearity in patsy? I would like to get the same result as stata, where variables that are almost perfectly collinear are dropped from the regression
Activity
josef-pkt commentedon Mar 29, 2014
see #452 and #953
GLM uses WLS with uses
pinvand should be robust (most likely) to singular exog, but will pick "some" solution.If it's really singular, then we don't need to match the params, we only need to match fittedvalues, if there are different ways of handling singular matrices. We pinv, Stata drops variables, patsy might drop columns, no idea what R does. discrete_model breaks with default optimizer newton.
jseabold commentedon Mar 29, 2014
Yeah I have no idea what R's doing there. I didn't get into it. Just noticed that we're having "problems" on this textbook example. I think it's a poor model, but I'd like to dig in a little more.
Having patsy do the multicollinearity handling for us seems nice, but also potential for more duplicate code when we don't go through patsy.
josef-pkt commentedon Mar 29, 2014
my guess is that patsy handles only perfect multicollinearity, like dropping a level of a categorical variable (in an interaction term) if there are no observations for it.
patsy shouldn't decide and drop in the case of almost perfect collinearity (eigenvalue 1e-xxx).
try fit_regularized on the example, that needs more advertising.
jseabold commentedon Mar 29, 2014
AFAIK, patsy doesn't do anything.
I think it's simply a case of way too many (sparse) dummy variables.
josef-pkt commentedon Mar 29, 2014
same with categorical variables:
scollie commentedon Oct 26, 2014
Has anybody thought of how to deal with near-perfect collinearity in patsy? I would like to get the same result as stata, where variables that are almost perfectly collinear are dropped from the regression