Announcement

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

  • Backward stepwise regression. ​​​​​​​

    Hello everyone,
    I have a question regarding backward stepwise regression.

    My dependent variable is a binary variable.
    My independent variable is a categorical variable.
    Variables A and B are included in these model (1 of them is categorical)

    This is my STATA command.
    -. stepwise, pr(.1) pe(0.05): clogit dependantvariable i.indepedantvariable i.variableA variableB, group(pairID)or iterate(20)-

    However, “factor variables and time-series operators not allowed” appears as the output when the command was applied.

    May I know how to proceed with this and how to carry out backward stepwise regression when using categorical independent variables?

    Thank you. Any help is appreciated

  • #2
    since the help file for stepwise says that "xi" is allowed, I'm guessing that factor variable notation is not allowed; so you probably need to change your code to use "xi" - see
    Code:
    help xi

    Comment


    • #3
      Yes, you can do something like this:

      Code:
      xi: sw, pr(.1) pe(.05): reg height weight (i.race)
      I put parentheses around race so all terms would either be entered or not entered but if you are willing to split them up you can leave them off.

      Before doing this, though, you should keep in mind that stepwise regression is generally viewed as the work of the devil:

      https://www.stata.com/support/faqs/s...sion-problems/
      -------------------------------------------
      Richard Williams, Notre Dame Dept of Sociology
      Stata Version: 17.0 MP (2 processor)

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

      Comment


      • #4
        Dear Richard

        Thank you so much for this code. It is powerful.
        Code:
        xi: sw, pr(.1) pe(.05): reg height weight (i.race) for Backward stepwise regression.

        It worked for in Logistic regression analysis:

        xi: sw, pr(.1) pe(.05): logistic stunting_h2 i.age_months_h2 i.marriage_h2 i.medu_h2 i.age_wom_h2 i.diarrhea_h2 i.smallsize_h2 i.w_emp_h2 h_emp_h2 i.comm_res_h2 i.hhmem_h2

        Now I have a problem. Does this code allow insertion " svy, subpop(marriage)" since I am considering analysing the subpopulation of married households?

        Thanks
        Lambert KWIZERA
        Rwanda

        Comment


        • #5
          Hello everyone.
          I would like to request assistance on creating a single variable representing multiple variables as indicated in these attachments. How can I combine multiple variable into one variable?
          I have variables: "Telephone, Radio, Television, Bicycle, motorbike". How can one combine these variables and make one variable in Stata. Yes means there is ownership, No means there is not.

          I want to create a variable that indicates of household living standards (Wealth), such that it may indicate the ownership or not.

          Any advice or other resources would be appreciated.

          Thanks
          Attached Files

          Comment


          • #6
            I want to create a variable that indicates of household living standards (Wealth), such that it may indicate the ownership or not.
            I don't understand what you want. Do you want a yes/no variable showing whether the person owns any of these things? Or a count of how many are owned? Or a yes/no variable showing whether the person owns all of them? Or something else (what?)

            Before responding, please take the time to read the Forum FAQ for excellent advice on how to post questions in ways that maximize your chances of getting a timely and helpful response. Among the things you will learn there:
            1. Attachments are discouraged. The helpful way to show example data is with the -dataex- command. If you are running version 17, 16 or a fully updated version 15.1 or 14.2, -dataex- is already part of your official Stata installation. If not, run -ssc install dataex- to get it. Either way, run -help dataex- to read the simple instructions for using it. -dataex- will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.
            2. Screenshots are also discouraged.
            Added: Also, this question has no relationship to the topic of this thread. Please, when posting back, start a New Topic thread with a title that reflects what it is about.

            Thank you.
            Last edited by Clyde Schechter; 06 Feb 2023, 13:17.

            Comment

            Working...
            X