Announcement

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

  • use margins command to calculate predicted probabilities

    I know it is easy to calculate predicted probabilities using margins command in logistic models, as the link below:

    https://stats.idre.ucla.edu/stata/da...probabilities/

    Eg, specifically, STATA can calculate the predicted probabilities on each level of female with holding other covariates at means with the following below

    margins female, atmeans My question is: what types of predicted probabilities I can get if I do not include "atmeans"? just simply puts

    margins female

    Thanks!

  • #2
    Welcome to Statalist.

    Rather than address your question directly, let me point you to another online source.

    You may find the explanation you need, and more, in the nice overview of margins prepared by Richard Williams, a frequent contributor here, at https://www3.nd.edu/~rwilliam/stats3/Margins01.pdf with a more detailed paper in the Stata Journal at http://www.stata-journal.com/article...article=st0260. I'll also note that Margins01.pdf is followed by Margins02.pdf ... Margins05.pdf covering more specialized topics.

    And all five of these PDFs, and plenty more of use to someone learning about the analysis of categorical data, are linked to from his course page at http://www3.nd.edu/~rwilliam/stats3/ - the material mentioned above is found in the section headed Interpreting results: Adjusted Predictions and Marginal effects.

    Comment


    • #3
      Thank you William!

      I did not find the answers to my question in the paper "Margins01". Let me put my question more specific: outcome variable is admin ( college admission, 0 or 1) , I want to find its predicted probabilities across age groups, gender and race groups. Is the following code correct?

      logit admin i.age i.gender i.race
      margins age gender race

      Comment


      • #4
        Carl, margins can generate MEMs (marginal effects at the means), AMEs (Average Marginal Effects), MERs (Marginal Effects at Representative Values), AAP(Average Adjusted Predictions) and others. As William notes, it is wise to go over Richard William's amazing notes to get more familiar what the command can do and explore each of these options.

        If you don't specify 'atmeans' option, Stata would calculate average marginal effects.

        If all you are interested in is to get predicted probabilities instead of log-odds, you can use the following command after logit :
        Code:
        margins, dydx(*)
        This will give you average marginal effects (AMEs) for each category of the variables in the logit model. You can read on the AMEs to understand how it is calculated.

        If what you are after is to calculate marginal effects for, say gender, when age groups are at different values (interaction in a way), then you need to specify that in your command. Again, Richard Williams's pdfs are amazing sources.

        Just for a quick reference, let's say that your age variable has 4 categories, ranging from 1 to 4. Then to see the marginal effects of gender on college admissions for each age category, you can use the following command:
        Code:
        margins gender, at(age=(1(1)4))
        And you can use "marginsplot" right after to see the graphical representation of the predicted marginal probabilities.

        Comment


        • #5
          Thanks Sule for your answer, It is very helpful ! I am also using SAS, does SAS can do the same thing (predicted probabilities) as STATA?

          Comment


          • #6
            Unfortunately, I never used SAS. Good luck!

            Comment


            • #7
              This post suggests SAS can't do it:

              https://communities.sas.com/t5/SAS-S...ic/td-p/416260

              Starting around slide 27, this handout describes do-it-yourself margins. I wouldn't want to do it unless my life depended on it though:

              https://www3.nd.edu/~rwilliam/stats3/Margins01.pdf

              Another do it yourself approach is described in Appendix A of

              https://www3.nd.edu/~rwilliam/xsoc73994/Margins02.pdf

              -------------------------------------------
              Richard Williams, Notre Dame Dept of Sociology
              StataNow Version: 19.5 MP (2 processor)

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

              Comment

              Working...
              X