Announcement

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

  • Question about odds ratio for continuous variable of interest

    Let's say I have a binary variable Y and an ordinal predictor X1 (i.e., X1 = 0, 1, 2, 3, 4, etc.). I regress Y on X1 in a logit, and the coefficient on X1 is -0.051293294, so the odds ratio of X1 is 0.95. Therefore, a one unit increase in X1 lowers the odds of Y = 1 by 5%.

    Let's say I want to calculate the odds when X1 = 4. How do I calculate that in Stata? Since this is a nonlinear model, I can't simply do 5% * 4, correct? Is it appropriate to do -0.051293294 * 4 and then calculate the odds ratio of that value, which would be 0.81? Is it appropriate to call this an odds ratio?

  • #2
    Well, an odds ratio is just that, a ratio of two odds. To get a single odds, you have to apply the odds ratio to some other odds. Assuming there are no other variable in your logit model, the constant term in the model gives you the log odds of Y conditional on X1 = 0. So the odds of Y when X = 4 is exp(_b[_cons] + 4*_b[X1]). Rather than calculating that by hand you can let Stata do it for you with
    Code:
    lincom _cons + 4*X1, eform
    Note: If there are other variables in the -logistic- model besides X1 and Y then this no longer works. In fact, if there are other variables in the model, it is not enough to just pick a value of X1. You must also specify how you want to handle the other predictors as well. In any case these calculations get complicated, and while it is possible to do them with -lincom-, it is not advisable. Better in that case to use the -margins- command.

    Comment


    • #3
      Please show what you meant by - regress - command. Was it - logit - or something else? Additionally, we don’t know the range of the ordinal variable, neither we can figure out whether factor notation was applied.

      Please take a look at the Stata Manual under - logistic - command. You will find great information with regards to the interpretation.

      Please take a look at the FAQ. There you’ll find how to share data/output/command.

      To end, apparently, there is a contradiction between the title and the post. The first one refers to a continuous variable whereas the second one refers to an ordinal variable.

      PS: crossed with Clyde’s insightful reply.
      Last edited by Marcos Almeida; 13 Apr 2019, 17:47.
      Best regards,

      Marcos

      Comment


      • #4
        Originally posted by Clyde Schechter View Post
        Well, an odds ratio is just that, a ratio of two odds. To get a single odds, you have to apply the odds ratio to some other odds. Assuming there are no other variable in your logit model, the constant term in the model gives you the log odds of Y conditional on X1 = 0. So the odds of Y when X = 4 is exp(_b[_cons] + 4*_b[X1]). Rather than calculating that by hand you can let Stata do it for you with
        Code:
        lincom _cons + 4*X1, eform
        Note: If there are other variables in the -logistic- model besides X1 and Y then this no longer works. In fact, if there are other variables in the model, it is not enough to just pick a value of X1. You must also specify how you want to handle the other predictors as well. In any case these calculations get complicated, and while it is possible to do them with -lincom-, it is not advisable. Better in that case to use the -margins- command.
        Thank you for the helpful reply.

        I'm actually running a conditional logit, rather than a regular logit, so I couldn't use the margins command, correct?

        Can you help me understand how Stata provides the odds ratio when using the -or- option -- is it holding all the other variables at their mean because, as you say, if the model has other predictors you cannot simply pick a value of X1?

        Basically, what you are saying is doing -lincom 4*X1,or- would not be correct since I have other covariates in the model?

        Any further tips on how I can do this would be great!

        Comment


        • #5
          Originally posted by Marcos Almeida View Post
          Please show what you meant by - regress - command. Was it - logit - or something else? Additionally, we don’t know the range of the ordinal variable, neither we can figure out whether factor notation was applied.

          Please take a look at the Stata Manual under - logistic - command. You will find great information with regards to the interpretation.

          Please take a look at the FAQ. There you’ll find how to share data/output/command.

          To end, apparently, there is a contradiction between the title and the post. The first one refers to a continuous variable whereas the second one refers to an ordinal variable.

          PS: crossed with Clyde’s insightful reply.
          Thanks for the tips. I think my reply to Clyde also responds to your questions.

          Comment


          • #6
            If you are doing a conditional logistic regression, it is not possible to calculate the odds of Y for a given value of X1, even if X1 is the only variable in the model. The results of conditional logistic regression give you only the relative odds of Y for different values of X1, but the absolute levels of Y are lost because of the conditioning on the group effects.

            When -lincom- provides an odds ratio, those results do not depend on the values of X1 or any of the other variables. In the logistic regression model (conditional or otherwise), the odds ratios are constant (unless there is an explicit interaction term in the model). The odds themselves, however, do depend on the actual values of the variables. But, as already noted, in a conditional logistic regression model, the odds are not identifiable anyway.
            Last edited by Clyde Schechter; 14 Apr 2019, 21:21.

            Comment


            • #7
              Originally posted by Clyde Schechter View Post
              If you are doing a conditional logistic regression, it is not possible to calculate the odds of Y for a given value of X1, even if X1 is the only variable in the model. The results of conditional logistic regression give you only the relative odds of Y for different values of X1, but the absolute levels of Y are lost because of the conditioning on the group effects.

              When -lincom- provides an odds ratio, those results do not depend on the values of X1 or any of the other variables. In the logistic regression model (conditional or otherwise), the odds ratios are constant (unless there is an explicit interaction term in the model). The odds themselves, however, do depend on the actual values of the variables. But, as already noted, in a conditional logistic regression model, the odds are not identifiable anyway.
              I'm sorry, I'm confused now. If one cannot obtain odds ratio in -clogit-, what does Stata provide me when I use the -or- option for -clogit-?

              Comment


              • #8
                You can obtain odds ratios with conditional regression. You can't obtain odds. So, if the coefficient of X1 is -0.05, the odds ratio is approximately 0.95 per unit of X1. So the odds ratio for a change of 4 in X1 would be 4*0.95 = 3.8.

                But the odds of Y at X1 = 4 (or at any other value of X1) cannot be determined after conditional logistic regression.

                Comment


                • #9
                  Originally posted by Clyde Schechter View Post
                  You can obtain odds ratios with conditional regression. You can't obtain odds. So, if the coefficient of X1 is -0.05, the odds ratio is approximately 0.95 per unit of X1. So the odds ratio for a change of 4 in X1 would be 4*0.95 = 3.8.

                  But the odds of Y at X1 = 4 (or at any other value of X1) cannot be determined after conditional logistic regression.
                  Thank you for clarifying. I will need to read up on the differences between odds ratio and odds to better understand this.

                  However, are you sure the odds ratio for a change of 4 in X1 would be 3.8? That seems odd to me because the odds ratio would linearly increase even though this is a nonlinear model. Keeping with your logic, shouldn't it be e^(4*-0.05), which is an odds ratio of 0.8187 -- which I would normally interpret as the odds of Y = 1 for values where X1 = 4 is 18.73% lower compared to X1 = 0, but you are saying that is not possible with conditional logit?

                  Comment


                  • #10
                    Sorry, you are correct, it should, indeed, be exp(4*-0.05). And it would be correct that this means that the odds of Y = 1 for values where X1 = 4 is 18.73% lower compared to when X1 = 0. But, that still doesn't tell you the actual odds of Y = 1 for either X1 = 0 or X1 = 4. You do know the ratio of those two odds, but you don't know either odds by itself.

                    Comment


                    • #11
                      Originally posted by Clyde Schechter View Post
                      Sorry, you are correct, it should, indeed, be exp(4*-0.05). And it would be correct that this means that the odds of Y = 1 for values where X1 = 4 is 18.73% lower compared to when X1 = 0. But, that still doesn't tell you the actual odds of Y = 1 for either X1 = 0 or X1 = 4. You do know the ratio of those two odds, but you don't know either odds by itself.
                      Ah, I think I'm finally starting to understand it. Thank you, sir, for your patience with me and the very helpful replies!

                      Comment

                      Working...
                      X