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: Why does a non-statistically significant covariate in a a regression model become significant in margins?


From   Joerg Luedicke <[email protected]>
To   [email protected]
Subject   Re: st: Why does a non-statistically significant covariate in a a regression model become significant in margins?
Date   Fri, 14 Dec 2012 10:34:02 -0500

I believe the basic problem here is that you are looking at different
kinds of quantities. Remember that the ZINB is a mixture model with a
count and a binary component. Your treatment effect from the count
component (1.treat =  .783026) is conditional on y>0, whereas the
marginal effect is the product of the probability of y>0 and the
expected count, given y>0.

This can easily be seen by doing some manual predictions. Below we set
up some toy data with a binary treatment variable such that treated
have a higher chance of having a zero count but, conditional on having
a positive count, have a lower count than controls, which is similar
to your data.

So first we simulate some data. This is some modified code that Joseph
Hilbe posted here:

http://www.stata.com/statalist/archive/2011-06/msg00183.html

*-----------
*Toy data
*-----------

clear
set obs `=1e4'
set seed 1234
gen x1 = rnormal()
gen treat = runiform()>.5

//Count component
gen xb = 2 + 0.5*x1 - 0.5*treat
gen a = .5
gen ia = 1/a
gen exb = exp(xb)
gen xg = rgamma(ia, a)
gen xbg = exb * xg
gen nby = rpoisson(xbg)

//Binary component
gen pi =1/(1+exp(-(0.5*x1 + 0.5*treat + 0.2)))
gen bernoulli = runiform()>pi
gen zy = bernoulli*nby
rename zy y

*---------------
*Predictions
*---------------

Then we can fit the model:

//Model fit
zinb y x1 treat, inflate(x1 treat)

and obtain marginal counts for the treatment arms:

//Marginal counts for control and treatment, using both components
margins, at(treat=(0 1))

which we can obtain manually by:

//Manual predictions
*Count component
gen count_c=exp(1.991823 + .543534*x1)
gen count_t=exp(1.991823 + .543534*x1 - .4944447)
*Binary component
gen p_c = 1 - ( exp(.2354296 + .4841011*x1 ) / (1+exp(.2354296 +
.4841011*x1) ) )
gen p_t = 1 - ( exp(.2354296 + .4841011*x1 + .5088653 ) /
(1+exp(.2354296 + .4841011*x1 + .5088653) ) )
*Product
gen control = count_c * p_c
gen trt = count_t * p_t
sum control trt

As we can see, we use parameters from both components to predict the
counts. If we wanted to predict counts from only the count component
we could type:

*Marginal counts for control and treatment, using only count component
margins, at(treat=(0 1)) expression(exp(predict(xb)))

which is the same as:

sum count_c count_t

So it is not surprising that your two significance tests differ
because in both instances you are dealing with quite different
quantities.

Joerg


On Thu, Dec 13, 2012 at 3:48 PM, Ariel Linden, DrPH
<[email protected]> wrote:
> Hi Fellow Listers,
>
> I am getting conflicting results from the regression output for a covariate
> and when I subsequently run margins. More specifically, I ran -zinb- with
> the primary covariate of interest being treatment and got a p value of
> 0.152. I then ran margins to see the predicted values for treatment and
> non-treatment, and then ran contrasts. The contrast indicates that the
> difference between treatment and control is statistically significant (p
> value =  0.0048). See below for the output...
>
> Could this be due to the different methods of estimating the p values
> between the original regression and margins? If so, how do I reconcile the
> two? Obviously, the covariate can't be both significant and not-significant
> at the same time.
>
> Thanks!
>
> Ariel
>
> **** code ****
> . zinb readmittot $xs [pw= attwt], inflate($xs) robust irr
>
> <output omitted?
>
> Zero-inflated negative binomial regression        Number of obs   =
> 7264
>                                                   Nonzero obs     =
> 882
>                                                   Zero obs        =
> 6382
>
> Inflation model      = logit                      Wald chi2(9)    =
> 39.46
> Log pseudolikelihood = -801.1061                  Prob > chi2     =
> 0.0000
>
> ----------------------------------------------------------------------------
> --
>              |               Robust
>   readmittot |        IRR   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
> -------------+--------------------------------------------------------------
> --
> readmittot   |
>      1.treat |    .783026   .1337402    -1.43   0.152     .5602626
> 1.094361  //treatment is not significant
>         dxcg |   1.010933    .003087     3.56   0.000     1.004901
> 1.017002
>    preadmits |   .9912419   .0510683    -0.17   0.864     .8960375
> 1.096562
>     ervisits |   .9347274   .1392932    -0.45   0.651     .6979733
> 1.251789
>     opvisits |   .8799214   .1362863    -0.83   0.409     .6495399
> 1.192016
>          age |   1.001473   .0055586     0.27   0.791     .9906373
> 1.012427
>          sex |   1.045554   .1525712     0.31   0.760     .7854813
> 1.391736
>    cci_score |   .9187872   .0707482    -1.10   0.271     .7900797
> 1.068462
>          gap |   .9636616   .0135773    -2.63   0.009     .9374147
> .9906434
>        _cons |   .2499155   .1165989    -2.97   0.003     .1001526
> .6236259
> -------------+--------------------------------------------------------------
> --
> inflate      |
>      1.treat |   .3987922   .4116639     0.97   0.333    -.4080542
> 1.205639
>         dxcg |  -.2056051   .0401806    -5.12   0.000    -.2843577
> -.1268526
>    preadmits |  -.2580604   .2825054    -0.91   0.361    -.8117609
> .2956401
>     ervisits |  -.3233463   .3895552    -0.83   0.407    -1.086861
> .4401679
>     opvisits |  -.1520791   .4182457    -0.36   0.716    -.9718256
> .6676674
>          age |   .0327528   .0177659     1.84   0.065    -.0020678
> .0675734
>          sex |   .2615432   .4124321     0.63   0.526     -.546809
> 1.069895
>    cci_score |   -.337497   .2392857    -1.41   0.158    -.8064884
> .1314944
>          gap |  -.1037818   .0423225    -2.45   0.014    -.1867325
> -.0208311
>        _cons |   1.603676   1.316273     1.22   0.223     -.976172
> 4.183524
> -------------+--------------------------------------------------------------
> --
>     /lnalpha |  -1.116844   .5762305    -1.94   0.053    -2.246235
> .0125467
> -------------+--------------------------------------------------------------
> --
>        alpha |    .327311   .1886066                      .1057968
> 1.012626
> ----------------------------------------------------------------------------
> --
>
> . margins treat
>
> Predictive margins                                Number of obs   =
> 7264
> Model VCE    : Robust
>
> Expression   : Predicted number of events, predict()
>
> ----------------------------------------------------------------------------
> --
>              |            Delta-method
>              |     Margin   Std. Err.      z    P>|z|     [95% Conf.
> Interval]
> -------------+--------------------------------------------------------------
> --
>        treat |
>           0  |   .1214688   .0067881    17.89   0.000     .1081643
> .1347733
>           1  |   .0858302   .0094371     9.09   0.000     .0673339
> .1043266
> ----------------------------------------------------------------------------
> --
>
> . margins r.treat
>
> Contrasts of predictive margins
> Model VCE    : Robust
>
> Expression   : Predicted number of events, predict()
>
> ------------------------------------------------
>              |         df        chi2     P>chi2
> -------------+----------------------------------
>        treat |          1        7.97     0.0048 //treatment is significant
> ------------------------------------------------
>
> --------------------------------------------------------------
>              |            Delta-method
>              |   Contrast   Std. Err.     [95% Conf. Interval]
> -------------+------------------------------------------------
>        treat |
>    (1 vs 0)  |  -.0356385   .0126276     -.0603881    -.010889
> --------------------------------------------------------------
> **************end code**********************
> .
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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