Announcement

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

  • Stepwise with categorical and continous variables.

    Good morning Stata community,

    I am fully aware of the limitations of stepwise regression, but my boss asks me to run a backward stepwise regression on a stcox regression model. I am looking at the predictors of death for different diseases. However, my model includes both continous and categorical variables. I read many posts about that, especially this one:

    http://www.statalist.org/forums/foru...es?view=stream

    in which the person found a way to deal with stepwise regression because ALL his variables were categorical (he put -xi- in front of the command). I can't do what he did, because my variables, as I said, are continous and categorical. I couldn't find a post that deals with that exact problem

    So, here is my formal question: is backward stepwise regression with a mix of continous and categorical variables completely impossible to do or is there a way?

    Thank you very much for your answers,

    JM

  • #2
    Can you review the FAQ linked to from the top of this page, especially sections 10-12 that discuss how to give the reader the information he or she needs to make a considered response, and then post one or more examples (using the CODE delimiter as discussed in the FAQ) of what you have attempted to do and what Stata has responded with? I imagine a brief discussion of the characteristics of the variables you included will also be helpful. Be sure to include the version of Stata you are using (from the about command).

    Alternatively, perhaps someone will be able to point you along the right path on the basis of the information you've given thus far. My own suggestion at this point would be to forgo Stata factor notation, create separate dummy variables for each level of each of your categorical variables, and forgo the use of margins and other postestimation commands that depend on factor notation to link associated variables together.

    Comment


    • #3
      it can certainly be done; when you use "xi" do NOT put an "i" or anything else in front of the name(s) of the continuous variables; e.g.,
      Code:
      sysuse auto
      xi: sw, pr(.05): regress price i.rep78 gear

      Comment


      • #4
        Incidentally, if it was me, I would be tempted to force the dummies to enter as a block, e.g.

        Code:
        xi: sw, pr(.05): regress price (i.rep78) gear
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

        EMAIL: [email protected]
        WWW: https://www3.nd.edu/~rwilliam

        Comment


        • #5
          Thank you very much everyone. Your posts have greatly helped me.
          And I will insure to include my codes next time.

          Comment


          • #6
            Hi, I am wondering how forcing the factor variables to enter as a block would change the output in this case ? As how can we interpret "as a block"?

            Comment

            Working...
            X