Announcement

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

  • Regression with continuous dependent variable with ordinal independent variables

    Hello,

    Given a dependent continuous variable and multiple independent ordinal variables (such as from a likert scale), how do I fit a regression model? I have seen a similar forum for R but I am not sure how to do this in Stata (http://stats.stackexchange.com/quest...ndent-variable). Do I need to standardize the ordinal variables? I am using Stata 12.

    Any help is very much appreciated!

    Thank you,
    Rachel


  • #2
    Hello, Rachel,

    Welcome to the Stata Forum

    You seem to be talking about linear multiple regression.

    If so, please type in the Command Window:

    Code:
    . help regress
    You'll get many examples.

    With regards to the ordinal variables, I recommend you use the factor notation. In short, add a "i." before the categoric predictors.

    Hopefully that helps!

    Best,

    Marcos
    Best regards,

    Marcos

    Comment


    • #3
      A lot of times people treat ordinal independent variables as continuous. How reasonable that is probably depends on the coding -- do the categories seem to be more or less evenly spaced? If you want to do a formal test, try something like

      reg y i.x c.x
      testparm i.x

      If the test stat is insignificant you can justify treating x as continuous. Even if it is significant, you may want to consider whether the greater parsimony of treating it as continuous is worth it.

      For more thoughts, see

      http://www.statalist.org/forums/foru...dent-variables
      -------------------------------------------
      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
        If including an ordinal variable as if it were categorical, I typically use -contrast- to assess whether there is any trend in the categorical values:

        Code:
        . sysuse auto
        . reg price i.rep78
        [output omitted]
        
        . contrast p.rep78, noeffects
        
        Contrasts of marginal linear predictions
        
        Margins      : asbalanced
        
        ------------------------------------------------
                     |         df           F        P>F
        -------------+----------------------------------
               rep78 |
           (linear)  |          1        0.35     0.5578
        (quadratic)  |          1        0.65     0.4218
            (cubic)  |          1        0.11     0.7394
          (quartic)  |          1        0.02     0.8899
              Joint  |          4        0.24     0.9174
                     |
         Denominator |         64
        ------------------------------------------------
        This shows that even though -rep78- is an ordinal variable, the effects are not ordered, so nothing lost in treating it as categorical.

        hth,
        Jeph

        Comment


        • #5
          My testparm command earlier wasn't right. But you can do

          Code:
          sysuse auto, clear
          reg price i.rep78
          est store m1
          reg price c.rep78
          est store m2
          lrtest m1 m2, stats
          I'll have to read up on the contrast command Jeff uses. But he says "nothing lost in treating it as categorical." But based on what I did above I would say "nothing lost in treating it as continuous." So I am not sure how to reconcile the two.
          -------------------------------------------
          Richard Williams, Notre Dame Dept of Sociology
          Stata Version: 17.0 MP (2 processor)

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

          Comment


          • #6
            Part of the issue with my approach vs Jeff's may just reflect that the auto data is too dinky. I think the following analyses would all lead to the conclusion that health can be treated as a continuous variable.

            Code:
            webuse nhanes2f, clear
            reg weight i.health
            contrast p.health, noeffects
            reg weight o(1 2).health c.health
            testparm i.health
            reg weight i.health
            est store m1
            reg weight c.health
            est store m2
            lrtest m1 m2, stats
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            Stata Version: 17.0 MP (2 processor)

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

            Comment


            • #7
              Thank you all! This is very helpful and encouraging. The data is form a likert-type scale (0-3), so it makes sense to go with continuous rather than categorical, since there aren't any ordinal options in Stata. I have also run through the likelihood ratio and contrast tests and it doesn't seem to make a big difference for the model, so I will plan to go with continuous. Thanks again!

              Comment

              Working...
              X