Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Stepwise backward selection and categorical variables

    Hello statalisters,

    I'm doing a backward selection and my model is the following :

    stepwise, pr(.2) : regress yvar xvar1 i.xvar2 i.xvar3 i.xvar4

    Most of my independent variables are factorial, however, STATA does not accept them... What can I do to change my model and test those variables?

    Thank you for your help.

  • Clyde Schechter
    replied
    Yes, -stepwise- is one of the few dusty corners of Stata that won't work with factor variables. I imagine that the decision not to implement factor variable support in stepwise comes from two places.

    First, stepwise regression approaches are frowned upon by many statisticians and you will find that most commenters on this forum will discourage their use in any case. (See http://www.stata.com/support/faqs/st...ems/index.html for more explanation.)

    Second, suppose one of your factor variables has 5 levels. With stepwise regression, it is possible that the stepwise logic will end up including some but not all of the levels. While I don't know the details of how factor variables are implemented in Stata's executable, I can imagine that it would be very difficult to build that in.

    Anyway, assuming you are not deterred from using stepwise, you've found your workaround

    Leave a comment:


  • Dusan Petrovic
    replied
    Figured it out. You need to put [xi :] in front of the model

    xi : stepwise, pr(.2) : regress yvar

    Leave a comment:

Working...
X