Announcement

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

  • Logit Confidence Intervals

    Hi,

    I was wondering whether someone could help me get less confused.
    I have run a logit model , where the dependent variable is binary and the independent variable is a country dummy. It is conditioned on a subsample of people aged 16-24.
    Specifically, I have run the following code:


    Code:
    svy: logit Learning i.country if Agegroup==1
    
    margins, dydx(country)
    I get the following results:

    Code:
    Number of strata   =        10                  Number of obs     =     37,109
    Number of PSUs     =    37,109                  Population size   =  7,554,754
                                                    Design df         =     37,099
                                                    F(   1,  37099)   =       1.87
                                                    Prob > F          =     0.1710
    
    ------------------------------------------------------------------------------
                 |             Linearized
        Learning |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
       1.country |   .0546632   .0399255     1.37   0.171     -.023592    .1329184
           _cons |  -1.160101   .0146527   -79.17   0.000    -1.188821   -1.131381
    ------------------------------------------------------------------------------
    
    
    
    Conditional marginal effects
    
    Number of strata   =        10                  Number of obs     =     37,109
    Number of PSUs     =    37,109                  Population size   =  7,554,754
    Model VCE    : Linearized                       Design df         =     37,099
    
    Expression   : Pr(Learning), predict()
    dy/dx w.r.t. : 1.country
    
    
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
       1.country |   .0100735    .007433     1.36   0.175    -.0044955    .0246424
    ------------------------------------------------------------------------------
    My question is: How can the confidence interval include a negative number, when I am running a logit regression? They shouldn't be odds ratios as I didn't specify that option in the command? Should it not be bounded by 0 and 1 like the coefficient?

    Last edited by Anja Heimann; 05 Nov 2020, 08:16.

  • #2
    You asked for marginal effects, i.e. change in predicted proportion. A change can be positive or negative. So the confidence interval is not incompatible with what you asked for.

    In general the confidence intervals from margins use the delta method approximation, so assumes that the sampling distribution is normal. As a consequence it will not respect any bounds that you know must exist. As I said above, that is not a problem in your case, but may come up later.

    As an aside, you do not want to use if in combination with the svy: prefix, instead you want to use the subpop() option within svy instead, see help svy
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thanks Maarten, that makes sense. As to not using an if in combination with svy, thank you for pointing that out, I had overlooked it in the manual.

      If I wanted to get a binomial CI for the marginal effect out of this estimation process however, how would I go about doing that?
      I tried

      Code:
      bys country: ci proportion, exact
      but that did not provide me with the result I need.

      Comment


      • #4
        It looks like you don't want a marginal effect (change in proportion), but just a predicted proportion. Is that correct?
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          I am trying to test whether the difference in the people in age group 1 in two countries that are in Learning establishments is significant.
          From previous year's results I know that the coefficient of 0.0100735 multiplied by 100 should be the percentage difference between the two countries. So I need the margins command.
          But what I am trying to get to is how I can make my CI follow a binomial distribution.

          Comment


          • #6
            Edit: crossed with #5.

            Perhaps this will illustrate using -margins- for estimating predicted proportions:

            Code:
            webuse nhanes2f
            svyset psuid [pweight=finalwgt], strata(stratid)
            svy: logit diabetes i.sex
            margins i.sex
            margins, dydx(sex)
            and selected output:

            Code:
            . margins i.sex
            
            ------------------------------------------------------------------------------
                         |            Delta-method
                         |     Margin   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                     sex |
                   Male  |   .0291678   .0026414    11.04   0.000     .0237807     .034555
                 Female  |   .0390031   .0026753    14.58   0.000     .0335469    .0444594
            ------------------------------------------------------------------------------
            
            . margins, dydx(sex)
            
            ------------------------------------------------------------------------------
                         |            Delta-method
                         |      dy/dx   Std. Err.      t    P>|t|     [95% Conf. Interval]
            -------------+----------------------------------------------------------------
                     sex |
                 Female  |   .0098353   .0038657     2.54   0.016     .0019511    .0177194
            ------------------------------------------------------------------------------
            Note: dy/dx for factor levels is the discrete change from the base level.
            Last edited by Leonardo Guizzetti; 05 Nov 2020, 09:51.

            Comment


            • #7
              I believe -proportion- is what you're after. See the documentation for different CI types and a useful -percent- option. Continuing from the example in #6.

              Code:
              svy: proportion 1.diabetes, citype(exact) over(sex)

              Comment


              • #8
                Originally posted by Anja Heimann View Post
                I am trying to test whether the difference in the people in age group 1 in two countries that are in Learning establishments is significant.
                But what I am trying to get to is how I can make my CI follow a binomial distribution.
                That is impossible. A single confidence interval for a proportion can be based on a binomial (it is often a bad idea, but that is a different question). A confidence interval for a difference between proportions cannot be based a a binomial.

                I suspect we are dealing with an xy-problem (https://en.m.wikipedia.org/wiki/XY_problem). So we need to find out what the real question is that you want answered. Let's start with why you think you need a binomial confidence interval for a difference between proportions, what is that going to do for you that margins cannot?
                ---------------------------------
                Maarten L. Buis
                University of Konstanz
                Department of history and sociology
                box 40
                78457 Konstanz
                Germany
                http://www.maartenbuis.nl
                ---------------------------------

                Comment


                • #9
                  Thanks for all your answers.
                  I think running the logit command before margins has made me wrongly believe I need a binomial CI for results from the margins command too. I realise now that asking for a binomial CI for a difference in proportions, which is not binary by definition, is impossible and doesn't make sense.

                  Comment


                  • #10
                    Hi Maarten Buis,
                    Could you please tell me when we run the code: svy: logit d002 i.post i.p01, or
                    It gives us confidence interval of odds ratio, then what method (such as the standard maximum likelihood method, or the method of endpoint transformations, or the delta method, or bootstrapping) does the logit use to calculate confidence interval by default? I really desperately need this information.

                    Comment


                    • #11
                      https://www.stata.com/support/faqs/s...cs/delta-rule/
                      ---------------------------------
                      Maarten L. Buis
                      University of Konstanz
                      Department of history and sociology
                      box 40
                      78457 Konstanz
                      Germany
                      http://www.maartenbuis.nl
                      ---------------------------------

                      Comment

                      Working...
                      X