Repository navigation
Description
independently of whether the change is better than the current default:
- we might have more discrepancies in rcond/threshold across linalg function, ie. algorithm option
(main current candidate switching linalg method in GLM.fit IRLS) - It will change results compared to our current behavior. But most likely we don't have unit tests where the change in rcond affects the results.
e.g. Performance: Logit and GLM, and sklearn, IRLS slow with highly collinear exog #3990 sklearn classification examples are highly collinear, which seems to adversely affect GLM IRLS - results will depend on numpy version in highly collinear cases.
However, the current rcond independent of nobs is also fragile #2628
old issue for differences in threshold: #1662 (but mainly difference svd(x) versus svd(x.T x)
issue trigered by
scipy/scipy#7995 (comment)
ilayn: "These bounds are kind of standard. (well standard in the sense "that's what matlab does"). NumPy also picked these up for matrix_rank tolerance which should be inline with null basis column number. You can see more about it here https://www.ma.utexas.edu/documentation/lapack/node92.html
"
josef-pktd"
The lapack links says "p(m , n) is a modestly growing function of m and n"
My question is whether linear growth in m is not too much (e.g. sqrt(m) or log(M)?). statsmodels has some issues that constant in m (rcond independent of m) is too small.
"
TODO:
- check consistency across fit methods and matrix_rank
- check what p(m, n) (LAPACK) or in our case rcond(nobs) would look good in our applications. E.g. If something like law of large numbers in error accumulation holds, then it would be sqrt(nobs)
good example to start might be the overparameterized categorical exog in REF: pinv threshold, linear regression for almost singular #2628 - check whether we should stick with numpy default or override and try to have our own consistent rcond function
Activity
[-]REF: numpy lstsq changes default rcond in 1.14[/-][+]REF/SUMM: numpy lstsq changes default rcond in 1.14[/+]josef-pkt commentedon Oct 7, 2017
Other possibilities to make this less relevant:
including information about
rank(cov_params)although that wouldn't be informative if rank of cov_params is full because of a Ridge penalization, even if data is rank deficient.josef-pkt commentedon Oct 10, 2017
Another problem with rcond, this time in matrix_rank
example: is random generated (no seed defined), simple linear model
estimated with method QR (via wls_method argument in GLM Gaussian fit_irls, changes for #4001)
k_exog is 4, two are constant
pinv regularized with rank of cov_params = 3 (one missing because of collinearity)
QR does not regularize, two bse are huge
However, matrix_rank only looks at the largest eigen/singular value, and identifies rank as 1, i.e. 3 missing. (i.e. the rcond/singular condition was changed a several numpy versions ago, and doesn't produce meaningful results in this case. Note, results are not very reliable anyway, but QR shows the two unidentified parameters
res3 below is estimated with wls method QR
josef-pkt commentedon Jan 26, 2018
we get future warnings from numpy now
e.g.
https://ci.appveyor.com/project/josef-pkt/statsmodels/build/1.0.2827/job/6vokw8k0d0n3x897
MAINT: numpy compat, keep old rcond in lstsq, see statsmodels#3994
josef-pkt commentedon Mar 22, 2018
#4384 made changes to keep old behavior for lstsq
but what rcond we want to use is still open