Announcement

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

  • Interpretation of OR when predicting a proportion using a generalized linear model (glm) with a logit link and the binomial family

    Hi all,

    Stata 14.1 Mac OSX

    Can I please get some help with interpreting the OR, when the dependent variable is a proportion and the model has been generated using a generalized linear model with a logit link and the binomial family.

    Please consider the example and output below.

    Is the following statement correct?

    “In these caryards, a unit increase in mean displacement at the yard is associated with a 2.25% decrease in proportion of foreign cars at the yard”

    Thanks

    Mark

    Code:
     
    *Generate fake data with the proportion of foreign cars at 10 caryards,
    *and the mean displacement and price at each caryard
     
    sysuse auto, clear
    encode make, gen(Make)
    egen mpg_cat=cut(mpg), group(10)
    bys mpg_cat foreign: gen n=_N
    replace n=. if foreign ==0
    collapse (count) Make (max) n (mean) displacement price length weight, by(mpg_cat)
    gen prop_for=n/Make
    replace prop=0 if prop==.
    drop Make n
    gen caryard=_n
     
    *Question: generate a model that can predict the proportion of foreign cars at a caryard
    *as a function of the mean displacement and price at the yard
     
    glm prop_for displacement price, link(logit) family(binomial) robust nolog eform
     
    /*Output
     
    ------------------------------------------------------------------------------
                 |               Robust
        prop_for | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
    displacement |   .9751318   .0061639    -3.98   0.000     .9631253     .987288
           price |   1.000442   .0001958     2.26   0.024     1.000058    1.000826
           _cons |   2.802695   1.315976     2.19   0.028     1.116614    7.034748
    ------------------------------------------------------------------------------
    */
     
    list prop_for displacement price
     
         +-------------------------------+
         | prop_for   displa~t     price |
         |-------------------------------|
      1. |        0        400    12,546 |
      2. | .0833333     303.75   9,195.8 |
      3. |       .5     194.25     8,194 |
      4. | .2222222    220.556   5,068.2 |
      5. |        0    233.375   4,561.5 |
         |-------------------------------|
      6. |      .25    202.875   6,828.5 |
      7. |     .375    136.875   5,124.9 |
      8. |      .25        143   4,278.3 |
      9. | .5454546    124.182   5,448.4 |
     10. |     .625     108.75   4,154.4 |
         +-------------------------------+

  • #2
    ******From Kit Baum******

    Mark,

    Nowadays I would use fracreg to do this same estimation (which will generally yield the same estimates). Scaling your explanatory variables into hundreds of c.i. and thousands of dollars,

    Code:
     
         +-----------------------------+
         |     var2      var3     var4 |
         |-----------------------------|
      1. |        0         4   12.546 |
      2. | .0833333    3.0375   9.1958 |
      3. |       .5    1.9425    8.194 |
      4. |    .2222   2.20556   5.0682 |
      5. |        0   2.33375   4.5615 |
         |-----------------------------|
      6. |      .25   2.02875   6.8285 |
      7. |     .375   1.36875   5.1249 |
      8. |      .25      1.43   4.2783 |
      9. | .5454546   1.24182   5.4484 |
     10. |     .625    1.0875   4.1544 |
         +-----------------------------+
     
    . fracreg logit var2 var3 var4, nolog
     
     
    Fractional logistic regression                  Number of obs     =         10
                                                    Wald chi2(2)      =      33.41
                                                    Prob > chi2       =     0.0000
    Log pseudolikelihood = -4.8693607               Pseudo R2         =     0.1853
     
    ------------------------------------------------------------------------------
                 |               Robust
            var2 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            var3 |  -2.518326   .6320985    -3.98   0.000    -3.757216   -1.279435
            var4 |   .4415495   .1957275     2.26   0.024     .0579307    .8251683
           _cons |    1.03061   .4695425     2.19   0.028     .1103232    1.950896
    ------------------------------------------------------------------------------
     
    . margins, dydx(*)
     
    Average marginal effects                        Number of obs     =         10
    Model VCE    : Robust
     
    Expression   : Conditional mean of var2, predict()
    dy/dx w.r.t. : var3 var4
     
    ------------------------------------------------------------------------------
                 |            Delta-method
                 |      dy/dx   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            var3 |  -.4113023    .072211    -5.70   0.000    -.5528332   -.2697714
            var4 |   .0721155   .0270166     2.67   0.008     .0191639     .125067
    ------------------------------------------------------------------------------
    That suggests to me that an increase in displacement of 100 c.i. would reduce the probability by 41%, and an increase in price by $1000 would increase the probability by 7.2%.

    Cheers

    Kit

    Comment

    Working...
    X