Repository navigation
Conversation
|
Based on TravisCI errors, the use of sparse LU solve requires at minimum scipy 0.14. |
24bf340 to
8928809
Compare
|
current status: using wexog, overriding df_resid, no other changes in subclass result of np.allclose at default precision this doesn't check/slice yet correctly the 2d covariances, see standard errors for results |
|
same after adding we get a different pattern (also fixed effects calculation fails) |
|
Here is another case: The only differences to dense OLS seem to be in the
I guess centered sum of squares are correct because of the constant handling (average of fixed effects should be zero in the current version) I currently only check a balanced panel data set. This looks like a keeper, I will start design choices for predict in PR description on top |
|
The last commits add reshaping between long and wide format is not "trivial" with numpy, especially for general ndim. Currently it is specialized for simple two-way fixed effects. There is a skipped test *OLS with ddof: * |
|
numpy <= 1.7 doesn't have nanmean |
|
typo in commit message: skip test if < 1.8.0 |
|
checking briefly with Stata f-value is against constant plus FE dummies, same as simply using OLS on absorb-transformed data. So, it looks like areg is doing essentially the same thing as OLS with pretransformed data and Difference to areg: We can absorb any number of fixed effects or categorical variables, not just one. |
| from statsmodels.tools._sparse import PartialingSparse, dummy_sparse | ||
|
|
||
| def cat2dummy_sparse(xcat, use_pandas=False): | ||
| """categorical to sparse dummy, use pandas for quick implementation |
There was a problem hiding this comment.
outdated pandas, now version using sparse directly
see #2568 for some design discussion, and references to different algorithms
We are partialing out fixed effects in panel data, or any categorical factor variable with many levels.
This includes currently only a sparse version for general multi-way factors.
Warning: some results in returned OLS are still wrong (fvalue, llf, ...)
see docstrings and comments for other current definitions and limitations.
currently missing: function that creates sparse dummy representation uses currently a dense intermediate array
see also #2711 for OLSSparse, is currently SparseOLS
module names and paths are not settled yet.
The projection class needs to be public.
Design issues
exog, wexog: currently I have the transformed exog in wexog using whiten
However, several things use the original exog.
are fine, those use wexog, transformed in current case
df_model:
predict, fittedvalues, residuals
The WLS version matches almost everything with the main exception in predict fittedvalues and resid. Those are designed for the values on the original scale and variable without taking the predictive effect of fixed effects into account. For predict we would have to solve for the fixed effects first before we can do any prediction.
see comment below ENH: large categorical, OLSAbsorb with sparse projection #2774 (comment)
inference, standard errors for fixed effects
I don't see a way to calculate those without creating the full sparse inv(x'x) where we can restrict x to the fixed effects. I think inv(x'x) might not be very sparse for a general case. We could store only the diagonal if we have memory problems, but we still need to calculate for example LU xtx.solve(np.eye) in chunks of np.eye columns. Can the argument for LU solve be a dense low memory dtype (e.g. bool)?
Orme/Yamagata. 2014: robust F-test for joint hypothesis that all individual effects are zero
applicability of different absorb methods
looks similar to this http://stats.stackexchange.com/questions/124662/group-fixed-effects-not-individual-fixed-effects-using-plm-in-r?rq=1
References
Orme, Chris D., and Takashi Yamagata. 2014. “A Heteroskedasticity-Robust F-Test Statistic for Individual Effects.” Econometric Reviews 33 (5-6): 431–71. doi:10.1080/07474938.2013.824792.
Related