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
Thanks @ajschumacher
The nice thing about using formulas for this is that it keeps factors/categorical columns together.
The disadvantage is that this will be slow for larger cases since it doesn't exploit any possible computational shortcuts.
I just merged something similar in #4683, but it doesn't handle categorical variables properly.
I think something like ajschumachers approach using formulas would be a good complement to 4683.
One requirement would be to make the model class optional, so it works also for other models like GLM and discrete models.
Another requirement would be to make the evaluation criterion optional, e.g. AIC, BIC or other measures.
I just started again to work on score_test for variable addition, which could be used together with wald test for dropping variables. This is not available yet (at least not nicely outside of linear models), but it would be good if it's not very difficult to swap in other criteria to add or delete variables.
finally found the script for an experiment again
"\josef\eclipsegworkspace\statsmodels-git\local_scripts\local_scripts\try_tree.py"
Created on Mon Sep 15 14:29:37 2014
best subset of exog, when we don't have many exog.
(e.g. we have 10 exog variables and want to include 4)
AFAIR, we compute a shortened tree of all subset, this should find the best subset, not depending on the search path as in stepwise regression
part of docstring:
All possible subset by dropping leading case
this is the regression tree for all subset regressions with
dropping columns in QR.
References
Smith and Bremner
several articles by Gatu and Kontoghiorghes and co-authors
R has Leaps and Bounds based on Furnival and Wilson 1974
Sung-Soo Kim for an alternatve LDLinv column deletion
this was the article I based the tree on, but the tree is older
Gatu and Kontoghiorghes have a iterative list implementation instead
of the recursive structure that I have here.
One practical question is what is the storage requirement to keep copies
to continue in the branches.
Activity
ajschumacher commentedon Apr 23, 2015
@trevor-smith and I wrote a little forward selection function for linear regression with statsmodels: http://planspace.org/20150423-forward_selection_with_statsmodels/
josef-pkt commentedon Apr 24, 2015
Thanks @ajschumacher
The nice thing about using formulas for this is that it keeps factors/categorical columns together.
The disadvantage is that this will be slow for larger cases since it doesn't exploit any possible computational shortcuts.
ajschumacher commentedon Apr 24, 2015
@josef-pkt True!
DanielTParry commentedon May 30, 2018
Thinking about trying this as a project. Are there any specific requirements to this?
josef-pkt commentedon May 30, 2018
I just merged something similar in #4683, but it doesn't handle categorical variables properly.
I think something like ajschumachers approach using formulas would be a good complement to 4683.
One requirement would be to make the model class optional, so it works also for other models like GLM and discrete models.
Another requirement would be to make the evaluation criterion optional, e.g. AIC, BIC or other measures.
I just started again to work on score_test for variable addition, which could be used together with wald test for dropping variables. This is not available yet (at least not nicely outside of linear models), but it would be good if it's not very difficult to swap in other criteria to add or delete variables.
josef-pkt commentedon Oct 27, 2019
finally found the script for an experiment again
"\josef\eclipsegworkspace\statsmodels-git\local_scripts\local_scripts\try_tree.py"
Created on Mon Sep 15 14:29:37 2014
best subset of exog, when we don't have many exog.
(e.g. we have 10 exog variables and want to include 4)
AFAIR, we compute a shortened tree of all subset, this should find the best subset, not depending on the search path as in stepwise regression
part of docstring:
All possible subset by dropping leading case
this is the regression tree for all subset regressions with
dropping columns in QR.
References
Smith and Bremner
several articles by Gatu and Kontoghiorghes and co-authors
R has Leaps and Bounds based on Furnival and Wilson 1974
Sung-Soo Kim for an alternatve LDLinv column deletion
this was the article I based the tree on, but the tree is older
Gatu and Kontoghiorghes have a iterative list implementation instead
of the recursive structure that I have here.
One practical question is what is the storage requirement to keep copies
to continue in the branches.
josef-pkt commentedon Nov 22, 2019
#4813 cross link to PR with backwards elimination