Dear Stata listers,
I'm using Stata version 13.1.
I'd have a question about Stata user-written command "vselect", in particular about the inclusion of categorical variables.
It seems to me that, in case groups are more than 2, it is possible to tell the software they are factor variables in the usual way (with the prefix "i." before the variable and "xi" before the command), but not to consider all categories jointly (so that a given factor variable is either included or excluded in its whole by each regression).
Let me explain my point: in a stepwise regression, where var1 is the outcome and var2 and var3 the categorical regressors, it is possible to introduce the constraint that (in case of inclusion) all categories of var3 have to be considered jointly (of course, apart from the reference category) by using parentheses (while still considering all var2 categories different from the reference one as separated dummy variables). The command could be like that:
xi: sw, pe (0.05) pr (0.10): regress outcome i.var2 (i.var3)
On the contrary, it seems to me the inclusion of parentheses for regressors with the "vselect" command is useless.
E.g.:
xi:vselect outcome i.var2 (i.var3), best
and
xi:vselect outcome i.var2 i.var3, best
would be exactly treated in the same way (each category different from the reference one being treated as a separate variable indeed).
In my opinion, this makes results dependent on the reference category chosen for factor variables with more than 2 categories. Also, the possibility to force factor variables to be either completely included or excluded would reduce the numbers of options to consider for each possible number of regressors.
I was wondering whether there is some obvious solution to it by using some other commands in advance to define a list of variables (like "selectvars" or "tuples") and whether allowing for the inclusion of factor variables in the "fix" option was seen as a workaround for this problem (the inclusion of factor variables being decided outside the "vselect" command, and then the factor variables included being forced into each model by "fix").
Could you help me with this issue?
Thanks in advance.
Reference:
Lindsey C. and S. Sheather (2010), Variable Selection in Linear
Regression, The Stata Journal, 10:650-669.
I'm using Stata version 13.1.
I'd have a question about Stata user-written command "vselect", in particular about the inclusion of categorical variables.
It seems to me that, in case groups are more than 2, it is possible to tell the software they are factor variables in the usual way (with the prefix "i." before the variable and "xi" before the command), but not to consider all categories jointly (so that a given factor variable is either included or excluded in its whole by each regression).
Let me explain my point: in a stepwise regression, where var1 is the outcome and var2 and var3 the categorical regressors, it is possible to introduce the constraint that (in case of inclusion) all categories of var3 have to be considered jointly (of course, apart from the reference category) by using parentheses (while still considering all var2 categories different from the reference one as separated dummy variables). The command could be like that:
xi: sw, pe (0.05) pr (0.10): regress outcome i.var2 (i.var3)
On the contrary, it seems to me the inclusion of parentheses for regressors with the "vselect" command is useless.
E.g.:
xi:vselect outcome i.var2 (i.var3), best
and
xi:vselect outcome i.var2 i.var3, best
would be exactly treated in the same way (each category different from the reference one being treated as a separate variable indeed).
In my opinion, this makes results dependent on the reference category chosen for factor variables with more than 2 categories. Also, the possibility to force factor variables to be either completely included or excluded would reduce the numbers of options to consider for each possible number of regressors.
I was wondering whether there is some obvious solution to it by using some other commands in advance to define a list of variables (like "selectvars" or "tuples") and whether allowing for the inclusion of factor variables in the "fix" option was seen as a workaround for this problem (the inclusion of factor variables being decided outside the "vselect" command, and then the factor variables included being forced into each model by "fix").
Could you help me with this issue?
Thanks in advance.
Reference:
Lindsey C. and S. Sheather (2010), Variable Selection in Linear
Regression, The Stata Journal, 10:650-669.

Comment