Announcement

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

  • How Margins actually calculate

    Hello, I have some questions about using `margins` command after estimate logit reg

    Given the example code as follows:


    Code:
    use https://stats.idre.ucla.edu/stat/stata/dae/binary.dta, clear
    logit admit gre gpa
    Then if I run:

    Q01:
    Code:
    margins, atmeans
    → This will simply use the mean value of gre and gpa then replaced into logit regression → Is this correct?

    Q02:
    Code:
    margins, at(gre=(500))
    → This will replace GRE=500 while keeping GPA at mean value → Is this correct?



    Q03:
    Then what if I run with dummy variables:

    Code:
    logit admit gre gpa i.rank
    Code:
    margins, atmeans
    → which value of the rank dummy is used here?
    → If Stata use the average value of rank (2.485) then which coefficient (out of the 4 coefficient for rank) does it use?

    Here is the result:

    Code:
    Adjusted predictions                                       Number of obs = 400
    Model VCE: OIM
    
    Expression: Pr(admit), predict()
    At: gre    =  587.7 (mean)
        gpa    = 3.3899 (mean)
        1.rank =  .1525 (mean)
        2.rank =  .3775 (mean)
        3.rank =  .3025 (mean)
        4.rank =  .1675 (mean)
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |     Margin   std. err.      z    P>|z|     [95% conf. interval]
    -------------+----------------------------------------------------------------
           _cons |   .2986299   .0244784    12.20   0.000     .2506532    .3466066
    ------------------------------------------------------------------------------

    Q04: I want to calculate the economic effect for each variables in the logit equation. This is done by allowing the selected variable to vary by one standard deviation (mean +/- std) while keeping the rest variables at mean value. The difference between the two probability is the economic effect

    Is it possible to do this using margin command? I get stuck at:

    Code:
    margins, at(...)














    Last edited by Truong Quoc Phan; 26 Apr 2024, 20:25.

  • #2
    Which value of rank is used? It is using the mean for each category of rank, which is the percent that fall into each rank category. In your case, 15.75% of the respondents are in rank one, 37.75% are in rank 2, etc.

    Personal, I don’t like atmeans, especially for categorical 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


    • #3
      These handouts may help.

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

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

      Long & Freese's mchange command may be especially helpful given your interest in the 1 SD change.
      -------------------------------------------
      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
        Originally posted by Richard Williams View Post
        These handouts may help.

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

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

        Long & Freese's mchange command may be especially helpful given your interest in the 1 SD change.
        Thank you so much. This really helps
        I am really appreciate

        Comment

        Working...
        X