Announcement

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

  • Graphing coefficients vs predicted probabilities in STATA

    Hello,

    I want to create a graph where the X axis is a summed value of logistic regression coefficients and the Y axis is the predicted probability of the outcome.

    Lets say I have a logistic regression model that is logistic death a b c d e f with all variables being binary variables. Each variable will have its own contribution in terms of coefficients to the model and its is possible to have many different combinations of these variables. What I'm interested in is creating a line graph that shows more or less how the probability of death changes with different combinations of the coefficients.

    I can't figure it out but I've seen some similar things published in articles in my field. Please assist.

  • #2
    your question is not entirely clear to me (e.g., logistic produces odds ratios and those are multiplied not summed), but my guess is that after estimating your model you want something like
    Code:
    predict newvar1, pr
    predict newvar2, xb
    twoway scatter newvar1 newvar2
    of course you may not want a scatter plot - substitute what you want (actually -lowess- might be closest to what you want) and pretty up as wanted

    Comment


    • #3
      logistic regression can report odds ratios or beta coefficients.

      usually for prediction models the probability of an outcome is based on the sum of the beta coefficient of each variable in the model.
      Click image for larger version

Name:	Microsoft PowerPoint - Logistic regression & prediction score 16-17-12-09 - Google Chrome.jpg
Views:	1
Size:	26.6 KB
ID:	1430066


      If all the variables are binary/categorical then there is a minimum range of possible sum and a maximum range of possible sum. If all the variables are absent then you have the minimum summed score and if all are present then you have the maximum sum score.

      I want to create a graph that shows how the probability changes from the minimum range to the maximum range of summed scores.

      Does that make more sense? I may not be using the right terms.

      Comment


      • #4
        ah, I did forget about the "coef" option to -logistic-; notwithstanding that, or what you say in #3 which I also find confusing (are negative effects impossible?), the code I showed in #2 above will give you what I think you want; if you don't understand the code, I suggest you look at
        Code:
        help logistic postestimation##predict

        Comment


        • #5
          I'm sorry your answer isn't what I'm looking for. I think I need to better explain what I'm asking.

          Take the following logistic regression example

          logit[D+/D-]= B1X1 + B2X2+B3X3+B0

          Lets say all of the X variables are categorical/binary variables (they can either be zero or 1 for present vs absent). Lets ignore the intercept (B0) which is a fixed value. To me logit[D+/D-] is the sum of the relevant beta coefficients. If my terminology is wrong please correct me but just work with my language for now.

          If a variable is absent (ie zero) then it doesn't adjust the probability.

          I want stata to tell me what is the probability of an event if the sum of the coefficients is

          B1X1 alone
          B2X2 alone
          B3X3 alone
          B1X1+B2X2
          B1X1+B3X3
          B2X2+ B3X3
          B1X1+B2X2+B3X3

          These are all of the possible combinations of sums of beta coefficients.

          I want to create a graph showing how probability correlates with all of these values
          Last edited by Luke Masha; 16 Feb 2018, 10:14.

          Comment

          Working...
          X