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
I don't think we have any ready made standalone functions either for an exog directly, of for the results (score_obs ?) of an estimation result of discrete or GLM.
We should add multi-collinearity and collinearity/singular measures to get_diagnostic.
Those can be directly based on X, score_obs, hessian and/or cov_params.
We can have multicollinearity or near-singularity problems in the estimation results in non-linear models even when hessian inversion does not fail (which raises a warning).
However, adding them only to get_diagnostic will not make them available for results.summary().
Summary should add a extra_text warning for small eigenvalues and large condition number also for non-linear models.
No, not really a duplicate, just closely related topic. #2062 is to handle numerical perfect collinearity, and by extension maybe regularized versions of near perfect collinearity.
The issue here is to provide users which tools to identify or diagnose multicollinearity problems, whether they are strong enough for purely numerical problems or not.
Like VIF for exog, instead of a post-estimation diagnostic for OLS.
null space function (recent merge, > 1.0)
which might be useful. I haven't tried either.
related: partial correlation linalg computation requires invertible correlation matrix inv(corr). So cannot be directly used for perfectly collinear variables.
reminder #2380 has some of the function but fails now in singular case in one travis, i.e. don't use inv of singular matrix
I think the problem is that we need to distinguish essential singularity (subject to numerical noise) from high collinearity. The inv versions are designed for the latter.
But regularization using pinv or Ridge changes the behavior and results.
in the spirit of "avoid numerical ambiguities" i.e. avoid results driven by numerical noise or "arbitrary" thresholds.
either
use regularized to handle high and perfect multi-collinearity, or
stay far enough away from near singular cases, and look at only high multi-collinearity but not near singular. That is consider multicollinearity as a statistical or econometrics problem without numerical problems.
just an implementation thought: vif and other multicollinearity measures based on weighted x'x
In GLM and discrete we (should) have a hessian_factor, i.e. hessian is related to x' @ diag(w) @ x where w is the hessian factor.
This means we could use the same measures as for WLS, just use weighted x, e.g. sqrt(w) * x
similarly we could use score_obs for OPG variance, i.e score_factor * x
see also #1534 for perfect collinearity, singular matrix problems in GLM and discrete.
The actual computation in the car package is different and uses det of partitioned correlation matrix as in the generalized vif article Fox, J. and Monette, G. (1992)
So far I haven't found a reference that explains or justifies this for the GLM case.
older article by Weissfeld defines condition indices based on scaled cov_params (EIM) for GLM, no vif
car package uses the same scaled cov for vif
for Logit, observed and expected hessian are the same, so no distinction there.
I don't know when OPG and Hessian are identical as in OLS.
I thought it is the case with canonical link like Logit, but it's not.
update
There are still problems with the constant. The above was computed for demeaned slope exog, i.e. exog is orthogonal between constant and slope variables.
When constant is included without demeaning other variables, then numbers are all over the place.
maybe we need to absorb constant, i.e. condition on constant column to remove it's effect.
i.e. need partial inverse or conditioning as in sweep algorithm PR #6268
scaled cov_params Weissfeld and Sereika 1991 used for condition index, EIM - Fisher scoring, irls, or OIM - Newton-Raphson
recommend not to demean original exog for condition index, as by Belsley, Kuh, Welsch
WLS wexog
MacKinnon and Puterman 1989. using irls (EIM) weights, assumes original exog are scaled as desired, no rescaling of wexog
only condition number
Smith and Marx, Environmetrics 1990: wexog from irls, centered and scaled (correlation matrix), vif = diag(inv(corr)) and condition number of corr.
a reference for nonlinear:
condition indices based on hessian, irls wexog for logit and cox proportional hazard
Wax, Yohanan. "Collinearity diagnosis for a relative risk regression analysis: An application to assessment of diet‐cancer relationship in epidemiological studies." Statistics in medicine 11, no. 10 (1992): 1273-1287.
Activity
jseabold commentedon Jan 9, 2015
Dupe of #2062?
josef-pkt commentedon Jan 9, 2015
No, not really a duplicate, just closely related topic.
#2062 is to handle numerical perfect collinearity, and by extension maybe regularized versions of near perfect collinearity.
The issue here is to provide users which tools to identify or diagnose multicollinearity problems, whether they are strong enough for purely numerical problems or not.
Like VIF for exog, instead of a post-estimation diagnostic for OLS.
josef-pkt commentedon Nov 7, 2017
two more stackoverflow questions about how to identify collinear variables in the last few days.
update:
which might be useful. I haven't tried either.
related: partial correlation linalg computation requires invertible correlation matrix inv(corr). So cannot be directly used for perfectly collinear variables.
josef-pkt commentedon Nov 7, 2017
reminder #2380 has some of the function but fails now in singular case in one travis, i.e. don't use inv of singular matrix
I think the problem is that we need to distinguish essential singularity (subject to numerical noise) from high collinearity. The inv versions are designed for the latter.
But regularization using pinv or Ridge changes the behavior and results.
josef-pkt commentedon Nov 7, 2017
Need a FAQ and SUMM: (there are many open issues, e.g. #3367 #2628 #1717 #1534 )
in the spirit of "avoid numerical ambiguities" i.e. avoid results driven by numerical noise or "arbitrary" thresholds.
either
josef-pkt commentedon Jan 4, 2020
just an implementation thought: vif and other multicollinearity measures based on weighted x'x
In GLM and discrete we (should) have a
hessian_factor, i.e. hessian is related tox' @ diag(w) @ xwhere w is the hessian factor.This means we could use the same measures as for WLS, just use weighted x, e.g.
sqrt(w) * xsimilarly we could use
score_obsfor OPG variance, i.escore_factor * xsee also #1534 for perfect collinearity, singular matrix problems in GLM and discrete.
josef-pkt commentedon Jun 24, 2020
multicollinearity with weights (I downloaded it in 2017, but don't remember reading it)
Huang, Chien-Chia L., Yow-Jen Jou, and Hsun-Jung Cho. 2016. “A New Multicollinearity Diagnostic for Generalized Linear Models.” Journal of Applied Statistics 43 (11): 2029–43. https://doi.org/10.1080/02664763.2015.1126239.
also, (I think I never looked more closely into the GLM multicollinearity literature like)
Lesaffre, Emmanuel, and Brian D. Marx. 1993. “Collinearity in Generalized Linear Regression.” Communications in Statistics - Theory and Methods 22 (7): 1933–52. https://doi.org/10.1080/03610929308831126.
Mackinnon, Murray J., and Martin L. Puterman. 1989. “Collinearity in Generalized Linear Models.” Communications in Statistics - Theory and Methods 18 (9): 3463–72. https://doi.org/10.1080/03610928908830102.
(includes Ridge and bounds on WLS condition number )
josef-pkt commentedon Jul 3, 2020
R package car uses a vif computation based on cov_params
https://stats.stackexchange.com/questions/474964/calculating-variance-inflation-factor-for-logistic-regression-using-statsmodels/475233#475233
The actual computation in the car package is different and uses det of partitioned correlation matrix as in the generalized vif article Fox, J. and Monette, G. (1992)
So far I haven't found a reference that explains or justifies this for the GLM case.
older article by Weissfeld defines condition indices based on scaled cov_params (EIM) for GLM, no vif
car package uses the same scaled cov for vif
Lisa A. Weissfeld & Susan M. Sereika (1991) A multicollinearity diagnostic for
generalized linear models, Communications in Statistics - Theory and Methods, 20:4, 1183-1198,
https://doi.org/10.1080/03610929108830558
josef-pkt commentedon Jul 3, 2020
trying this out with Logit and GLM-Binomial
3 versions with similar values, based on
for Logit, observed and expected hessian are the same, so no distinction there.
I don't know when OPG and Hessian are identical as in OLS.
I thought it is the case with canonical link like Logit, but it's not.
update
There are still problems with the constant. The above was computed for demeaned slope exog, i.e. exog is orthogonal between constant and slope variables.
When constant is included without demeaning other variables, then numbers are all over the place.
maybe we need to absorb constant, i.e. condition on constant column to remove it's effect.
i.e. need partial inverse or conditioning as in sweep algorithm PR #6268
josef-pkt commentedon Jul 6, 2020
references for specific methods
recommend not to demean original exog for condition index, as by Belsley, Kuh, Welsch
only condition number
josef-pkt commentedon Jul 6, 2020
one thing I'm not sure about yet, i.e. how much does it matter
cov_params is the inv of hessian/OIM/EIM/OPG, in one case we standardize cov of some data in the other we standardize inverse of it.
condition indices are just reordered, but I don't know how it affects a vif definition.
josef-pkt commentedon Sep 11, 2021
a reference for nonlinear:
condition indices based on hessian, irls wexog for logit and cox proportional hazard
Wax, Yohanan. "Collinearity diagnosis for a relative risk regression analysis: An application to assessment of diet‐cancer relationship in epidemiological studies." Statistics in medicine 11, no. 10 (1992): 1273-1287.
scaled to unit length as in Belsley kuh welsch
josef-pkt commentedon Aug 12, 2024
found by chance
graphpad prism has warnings for unstable parameters and "ambiguous" models (i.e. parameters not well identified)
https://www.graphpad.com/guides/prism/latest/curve-fitting/reg_how-prism-identifies-unstable-.htm
https://www.graphpad.com/guides/prism/latest/curve-fitting/reg_unstable.htm
threshold is condition number of hessian greater than 10/sqrt(epsilon), where epsilon is the 64 bit machine epsilon 2.22e-16 (= 2**(-52) ),
that is, we can add warning directly based on hessian which will work for any model.
see #7695