Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Computation of ATT in logistic regression


From   Tim Wade <[email protected]>
To   [email protected]
Subject   Re: st: Computation of ATT in logistic regression
Date   Mon, 22 Nov 2010 13:39:08 -0500

I think something like this can be accomplished using the -margins-
command, posting the results and then using -lincon-. Note the
estimates from the logistic model differs from the linear model, but
not by much. See the Stata Reference Manual, -margins-,  Example 10.

sysuse auto.dta
xtile mpgcat=mpg, nq(2)
logistic foreign i.mpgcat  price
margins mpgcat, post coeflegend
lincom  _b[2.mpgcat]-_b[1bn.mpgcat]

*linear model for risk difference estimation
glm foreign mpgcat price, link(identity) fam(binomial)


Output below:

. sysuse auto.dta
(1978 Automobile Data)

. xtile mpgcat=mpg, nq(2)

. logistic foreign i.mpgcat  price

Logistic regression                               Number of obs   =         74
                                                  LR chi2(2)      =      12.96
                                                  Prob > chi2     =     0.0015
Log likelihood = -38.553753                       Pseudo R2       =     0.1439

------------------------------------------------------------------------------
     foreign | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
    2.mpgcat |   8.354628   5.601601     3.17   0.002     2.244991    31.09136
       price |   1.000155   .0001045     1.48   0.139     .9999497    1.000359
------------------------------------------------------------------------------

. margins mpgcat, post coeflegend

Predictive margins                                Number of obs   =         74
Model VCE    : OIM

Expression   : Pr(foreign), predict()

------------------------------------------------------------------------------
             |     Margin  Legend
-------------+----------------------------------------------------------------
      mpgcat |
          1  |   .1174213  _b[1bn.mpgcat]
          2  |   .5022026  _b[2.mpgcat]
------------------------------------------------------------------------------

. lincom  _b[2.mpgcat]-_b[1bn.mpgcat]

 ( 1)  - 1bn.mpgcat + 2.mpgcat = 0

------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
         (1) |   .3847812   .0984683     3.91   0.000     .1917869    .5777756
------------------------------------------------------------------------------

. glm foreign mpgcat price, link(identity) fam(binomial)

Iteration 0:   log likelihood = -38.096154
Iteration 1:   log likelihood = -37.994297
Iteration 2:   log likelihood = -37.986895
Iteration 3:   log likelihood = -37.986878
Iteration 4:   log likelihood = -37.986878

Generalized linear models                          No. of obs      =        74
Optimization     : ML                              Residual df     =        71
                                                   Scale parameter =         1
Deviance         =  75.97375649                    (1/df) Deviance =  1.070053
Pearson          =           74                    (1/df) Pearson  =  1.042254

Variance function: V(u) = u*(1-u)                  [Bernoulli]
Link function    : g(u) = u                        [Identity]

                                                   AIC             =  1.107753
Log likelihood   = -37.98687824                    BIC             = -229.6149

------------------------------------------------------------------------------
             |                 OIM
     foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
      mpgcat |   .3954284   .0937052     4.22   0.000     .2117696    .5790872
       price |   .0000299   .0000153     1.95   0.051    -1.19e-07    .0000599
       _cons |  -.4888139   .1646307    -2.97   0.003    -.8114841   -.1661437
------------------------------------------------------------------------------
Coefficients are the risk differences.


Hope this helps, Tim



On Mon, Nov 22, 2010 at 11:16 AM, Astrid Kiil <[email protected]> wrote:
> Does anybody know how to compute the average treatment effect for the treated (ATT) of an explanatory variables included in a logistic regression in Stata?
>
> (I want to do so in order to obtain a regression estimate that is comparable to the ATT obtained by propensity score matching, performed by e.g. psmatch2 or nnmatch).
>
> Thanks for your consideration.
> / Astrid
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index