Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Random effects logistic regression: -metan- v -xtlogit-


From   "Paul Pharoah" <[email protected]>
To   <[email protected]>
Subject   RE: st: Random effects logistic regression: -metan- v -xtlogit-
Date   Wed, 6 Dec 2006 14:20:01 -0000

Thanks Roger.  A single between study variance for both comparisons cannot
be right.

I have been playing around with this command a bit and get some very odd
results.

Using the same data set (9 studies) the output from the following series of
command

  -xtlogit caco allele1 allele2 if study>1, i(study) re or

  -xtlogit caco allele1 allele2 if study>2, i(study) re or

  -xtlogit caco allele1 allele2 if study>3, i(study) re or

  -xtlogit caco allele1 allele2 if study>4, i(study) re or

which eliminates one of the study sets at a time is:


.xtlogit caco allele1 allele2 if study>1, i(study) re or

Fitting comparison model:

Iteration 0:   log likelihood = -11538.253
Iteration 1:   log likelihood = -11538.213
Iteration 2:   log likelihood = -11538.213

Fitting full model:

tau =  0.0     log likelihood = -5267.0828
tau =  0.1     log likelihood = -5264.6107
tau =  0.2     log likelihood =  -5265.389

Iteration 0:   log likelihood = -5264.6107  (not concave)
Iteration 1:   log likelihood = -5259.6619  (not concave)
Iteration 2:   log likelihood = -5259.5018  (not concave)
Iteration 3:   log likelihood = -5258.9279
Iteration 4:   log likelihood = -5258.3001
Iteration 5:   log likelihood = -5258.2601
Iteration 6:   log likelihood = -5258.2598

Random-effects logistic regression              Number of obs      =
16661
Group variable (i): study                       Number of groups   =
8

Random effects u_i ~ Gaussian                   Obs per group: min =
622
                                                               avg =
2082.6
                                                               max =
5286

                                                Wald chi2(2)       =
7.45
Log likelihood  = -5258.2598                    Prob > chi2        =
0.0242

----------------------------------------------------------------------------
--
        caco |         OR   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
     allele1 |   1.050561   .1153839     0.45   0.653     .8470966
1.302894
     allele2 |   1.778096   .3759308     2.72   0.006     1.174875
2.691033
-------------+--------------------------------------------------------------
--
    /lnsig2u |  -5.132587
1.965858                     -8.985597   -1.279576
-------------+--------------------------------------------------------------
--
     sigma_u |   .0768198   .0755084                      .0111893
.5274041
         rho |   .0017906   .0035137                      .0000381
.0779578
----------------------------------------------------------------------------
--
Likelihood-ratio test of rho=0: chibar2(01) =  1.3e+04 Prob >= chibar2 =
0.000

. xtlogit caco allele1 allele2 if study>2, i(study) re or

Fitting comparison model:

Iteration 0:   log likelihood = -10687.799
Iteration 1:   log likelihood = -10687.797

Fitting full model:

tau =  0.0     log likelihood = -4559.6058
tau =  0.1     log likelihood = -4556.9484
tau =  0.2     log likelihood = -4557.6271

Iteration 0:   log likelihood = -4556.9484  (not concave)
Iteration 1:   log likelihood = -4551.3385
Iteration 2:   log likelihood = -4550.8101
Iteration 3:   log likelihood = -4550.7939
Iteration 4:   log likelihood = -4550.7938

Random-effects logistic regression              Number of obs      =
15434
Group variable (i): study                       Number of groups   =
7

Random effects u_i ~ Gaussian                   Obs per group: min =
622
                                                               avg =
2204.9
                                                               max =
5286

                                                Wald chi2(2)       =
7.45
Log likelihood  = -4550.7938                    Prob > chi2        =
0.0242

----------------------------------------------------------------------------
--
        caco |         OR   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
     allele1 |   1.050561   .1153839     0.45   0.653     .8470968
1.302895
     allele2 |   1.778098   .3759306     2.72   0.006     1.174876
2.691034
-------------+--------------------------------------------------------------
--
    /lnsig2u |  -5.132558
1.965825                     -8.985504   -1.279611
-------------+--------------------------------------------------------------
--
     sigma_u |   .0768209   .0755082                      .0111898
.5273949
         rho |   .0017906   .0035137                      .0000381
.0779552
----------------------------------------------------------------------------
--
Likelihood-ratio test of rho=0: chibar2(01) =  1.2e+04 Prob >= chibar2 =
0.000

. xtlogit caco allele1 allele2 if study>3, i(study) re or

Fitting comparison model:

Iteration 0:   log likelihood = -10096.462
Iteration 1:   log likelihood = -10096.433

Fitting full model:

tau =  0.0     log likelihood = -3968.7172
tau =  0.1     log likelihood = -3969.9616

Iteration 0:   log likelihood = -3968.7172
Iteration 1:   log likelihood = -3963.9951
Iteration 2:   log likelihood = -3963.9916
Iteration 3:   log likelihood = -3963.9916

Random-effects logistic regression              Number of obs      =
14586
Group variable (i): study                       Number of groups   =
6

Random effects u_i ~ Gaussian                   Obs per group: min =
622
                                                               avg =
2431.0
                                                               max =
5286

                                                Wald chi2(2)       =
8.50
Log likelihood  = -3963.9916                    Prob > chi2        =
0.0142

----------------------------------------------------------------------------
--
        caco |         OR   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
     allele1 |   .8319726   .1412296    -1.08   0.279     .5965066
1.160387
     allele2 |   1.965592   .5746718     2.31   0.021     1.108234
3.486226
-------------+--------------------------------------------------------------
--
    /lnsig2u |  -21.93577   6622.872                     -13002.53
12958.65
-------------+--------------------------------------------------------------
--
     sigma_u |   .0000172   .0571117                             0
.
         rho |   9.04e-11   5.99e-07                             0
.
----------------------------------------------------------------------------
--
Likelihood-ratio test of rho=0: chibar2(01) =     0.00 Prob >= chibar2 =
1.000

. xtlogit caco allele1 allele2 if study>4, i(study) re or

Fitting comparison model:

Iteration 0:   log likelihood = -9275.8601
Iteration 1:   log likelihood = -9275.7897
Iteration 2:   log likelihood = -9275.7897

Fitting full model:

tau =  0.0     log likelihood = -3261.5633
tau =  0.1     log likelihood = -3262.6943

Iteration 0:   log likelihood = -3261.5633
Iteration 1:   log likelihood = -3256.5289
Iteration 2:   log likelihood = -3256.5256
Iteration 3:   log likelihood = -3256.5256

Random-effects logistic regression              Number of obs      =
13403
Group variable (i): study                       Number of groups   =
5

Random effects u_i ~ Gaussian                   Obs per group: min =
622
                                                               avg =
2680.6
                                                               max =
5286

                                                Wald chi2(2)       =
8.50
Log likelihood  = -3256.5256                    Prob > chi2        =
0.0142

----------------------------------------------------------------------------
--
        caco |         OR   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
     allele1 |   .8319726   .1412296    -1.08   0.279     .5965066
1.160387
     allele2 |   1.965573   .5746652     2.31   0.021     1.108223
3.486189
-------------+--------------------------------------------------------------
--
    /lnsig2u |  -26.26776   57773.18                     -113259.6
113207.1
-------------+--------------------------------------------------------------
--
     sigma_u |   1.98e-06   .0571117                             0
.
         rho |   1.19e-12   6.86e-08                             0
.
----------------------------------------------------------------------------
--
Likelihood-ratio test of rho=0: chibar2(01) =     0.00 Prob >= chibar2 =
1.000



As you can see the first two results have the same estimates and variances
(despite different sample sizes), but the estiamtes then change for the
third and fourth (which are again the same.  This is not correct.




> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Roger Harbord
> Sent: 06 December 2006 07:24
> To: [email protected]
> Subject: Re: st: Random effects logistic regression: -metan- v -xtlogit-
>
>
> This suggests the discrepancy is due to different between-study
> variances for the two comparisons. In -metan- you're fitting each
> comparison separately with its own between-study variance. In -xtlogit-
> Paul Pharoah was fitting it all in a single model with a single
> between-study variance for both comparisons.
>
> Roger.
>
> Paul Seed wrote:
> > I tried repeating Paul Pharoah's analysis & got
> > essentially the same answers
> > However, the problem only arises when fitting both alleles at once.
> > If I use
> >         xtlogit case  allele2 if  allele0|  allele2, or
> > I get
> >
> -------------------------------------------------------------------------=
> -----
> >
> >         case |         OR   Std. Err.      z    P>|z|     [95% Conf.
> > Interval]
> >
> -------------+-----------------------------------------------------------=
> -----
> >
> >      allele2 |   1.011836   .0798964     0.15   0.882     .8667581
> > 1.181198
> >
> -------------+-----------------------------------------------------------=
> -----
> >
> >     /lnsig2u |  -4.015044    .701948                     -5.390836
> > -2.639251
> >
> -------------+-----------------------------------------------------------=
> -----
> >
> >      sigma_u |   .1343211   .0471432                      .0675141
> > .2672354
> >          rho |   .0054542   .0038077                      .0013836
> > .0212463
> >
> -------------------------------------------------------------------------=
> -----
> >
> > Likelihood-ratio test of rho=3D0: chibar2(01) =3D  4557.62 Prob
> >=3D chib=
> ar2
> > =3D 0.000
> >
> > This is very similar to -metan- & to -cc-
> >
> > cc  case  allele2 if  allele0|  allele2, by(st)
> >
> >
> >            study |       OR       [95% Conf. Interval]   M-H Weight
> > -----------------+-------------------------------------------------
> >                1 |   1.543568      .8175427   2.976996     8.822736
> > (exact)
> >                2 |   1.965573      1.073019    3.67396     8.657382
> > (exact)
> >                3 |   .7776123      .5184206   1.163567     29.46082
> > (exact)
> >                4 |   1.244903      .8505777   1.824859     25.93921
> > (exact)
> >                5 |   .9165455      .6630693   1.263553     41.88866
> > (exact)
> >                6 |   .8405524      .6093421   1.159476     43.69371
> > (exact)
> >                7 |   .9585875      .7257767   1.269623     53.53306
> > (exact)
> >                8 |   1.038503      .8535848   1.263426     102.7595
> > (exact)
> >                9 |   .9407818      .7907902   1.119215     137.0404
> > (exact)
> > -----------------+-------------------------------------------------
> >            Crude |   .9884827      .9012316   1.084181
> > (exact)
> >     M-H combined |   .9914067      .9038977   1.087388
> > -------------------------------------------------------------------
> > Test of homogeneity (M-H)      chi2(8) =3D    12.59  Pr>chi2 =3D 0.1268
> >
> >                    Test that combined OR =3D 1:
> >                                 Mantel-Haenszel chi2(1) =3D      0.03
> >                                                 Pr>chi2 =3D    0.8548
> >
> >
> >
> >> Date: Fri, 1 Dec 2006 09:50:44 -0000
> >> From: "Paul Pharoah" <[email protected]>
> >> Subject: st: Random effects logistic regression: -metan- v -xtlogit-
> >>
> >> multiple case-control studies differ (substantially) between metan-
> >> and =ADxtlogit- ?
> >>
> >> Data are from nine unmatched cases control studies of SNP genotype
> >>
> >> study =AD study variable
> >> gene00  RR genotype frequency in controls
> >> gene01  RQ genotype frequency in controls
> >> gene02  QQ genotype frequency in controls
> >> gene10  RR genotype frequency in cases
> >> gene11  RQ genotype frequency in cases
> >> gene12  QQ genotype frequency in cases
> >>
> >> study   gene00  gene01  gene02  gene10  gene11  gene12
> >> 1       228     141     19      241     188     31
> >> 2       149     144     21      148     119     41
> >> 3       252     299     74      254     290     58
> >> 4       256     274     68      251     251     83
> >> 5       425     499     127     314     307     86
> >> 6       309     353     108     354     350     104
> >> 7       328     391     109     609     669     194
> >> 8       947     1030    313     740     875     254
> >> 9       1054    1173    360     1083    1268    348
> >>
> >> The following command generates the random effects pooled OR for QQ
> >> vs RR
> >> genotype
> >>
> >> . metan  gene00 gene02 gene10 gene12, random or
> >>
> >>            Study |       OR   [95% Conf. Interval]    % Weight
> >> -
> >>
> -----------------+------------------------------------------------------=
> -
> >>
> >> 1                |  1.54357     .847914   2.80996      3.92373
> >> 2                |  1.96557     1.10822   3.48619       4.2419
> >> 3                |  .777612      .52893   1.14322      8.12115
> >> 4                |   1.2449     .864373   1.79296      8.81242
> >> 5                |  .916545     .672142   1.24982      11.0651
> >> 6                |  .840552      .61681   1.14546      11.0958
> >> 7                |  .958588     .731544    1.2561      13.1761
> >> 8                |   1.0385     .857574    1.2576      18.8354
> >> 9                |  .940782     .793702   1.11512      20.7284
> >> -
> >>
> -----------------+------------------------------------------------------=
> -
> >>
> >>   D+L pooled OR  |  1.00456     .885302   1.13988
> >> -
> >>
> -----------------+------------------------------------------------------=
> -
> >>
> >>   Heterogeneity chi-squared =3D  12.59 (d.f. =3D 8) p =3D 0.127
> >>   Estimate of between-study variance Tau-squared =3D  0.0125
> >>   Test of OR=3D1 : z=3D 0.07 p =3D 0.944
> >>
> >>
> >> And, the RQ vs RR random effects pooled OR
> >>
> >> . metan  gene00 gene01 gene10 gene11, random or
> >>
> >>            Study |       OR   [95% Conf. Interval]    % Weight
> >> -
> >>
> -----------------+------------------------------------------------------=
> -
> >>
> >> 1                |  1.26141     .949866   1.67514      6.51369
> >> 2                |  .831973     .596507   1.16039      4.98645
> >> 3                |  .962263     .758749   1.22036      8.60693
> >> 4                |  .934307     .731869   1.19274      8.25621
> >> 5                |  .832716     .679269   1.02083      10.7657
> >> 6                |  .865463     .699804   1.07034      10.1444
> >> 7                |  .921522     .767211   1.10687      12.4064
> >> 8                |  1.08715     .952918   1.24029      18.0585
> >> 9                |  1.05204     .936656   1.18164      20.2618
> >> -
> >>
> -----------------+------------------------------------------------------=
> -
> >>
> >>   D+L pooled OR  |  .978139     .902773    1.0598
> >> -
> >>
> -----------------+------------------------------------------------------=
> -
> >>
> >>   Heterogeneity chi-squared =3D  12.01 (d.f. =3D 8) p =3D 0.151
> >>   Estimate of between-study variance Tau-squared =3D  0.0047
> >>   Test of OR=3D1 : z=3D 0.54 p =3D 0.589
> >>
> >>
> >> If the data are reshaped from wide into long using the following
> >> series of
> >> commands
> >>
> >> . reshape long gene0 gene1 gene2, i(study) j(case)
> >> . reshape long weight ,  i(study case)  j(alleles)
> >> . expand weight
> >>
> >> The fixed effects pooled genotype specific effects obtained by logistic
> >> regression are the same as the fixed effects from =ADmetan-.  I.e.
> >>
> >> . xi: logistic case i.alleles, nolog
> >>
> >> i.alleles         _Ialleles_0-2       (naturally coded; _Ialleles_0
> >> omitted)
> >>
> >> Logistic regression                               Number of obs   =3D
> >> 18961
> >>                                                   LR chi2(2)      =3D
> >> 0.10
> >>                                                   Prob > chi2     =3D
> >> 0.9501
> >> Log likelihood =3D -13142.621                       Pseudo R2       =3D
> >> 0.0000
> >>
> >> -
> >>
> ------------------------------------------------------------------------=
> ----
> >>
> >> - --
> >>         case | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf.
> >> Interval]
> >> -
> >>
> -------------+----------------------------------------------------------=
> ----
> >>
> >> - --
> >>  _Ialleles_1 |   .9914684   .0308417    -0.28   0.783     .9328256
> >> 1.053798
> >>  _Ialleles_2 |   .9884827    .046065    -0.25   0.804     .9021974
> >> 1.08302
> >> -
> >>
> ------------------------------------------------------------------------=
> ----
> >>
> >> - --
> >>
> >>
> >> But, the random effects estimates using xtlogit and study as the panel
> >> variable are very different and clearly wrong.
> >>
> >> . xi: xtlogit case i.alleles , i(study) re or
> >> i.alleles         _Ialleles_0-2       (naturally coded; _Ialleles_0
> >> omitted)
> >>
> >> Fitting comparison model:
> >>
> >> Iteration 0:   log likelihood =3D -13142.672
> >> Iteration 1:   log likelihood =3D -13142.621
> >>
> >> Fitting full model:
> >>
> >> tau =3D  0.0     log likelihood =3D -5971.0991
> >> tau =3D  0.1     log likelihood =3D -5971.4368
> >>
> >> Random-effects logistic regression              Number of obs      =3D
> >> 18961
> >> Group variable (i): study                       Number of groups   =3D
> >> 9
> >>
> >> Random effects u_i ~ Gaussian                   Obs per group: min =3D
> >> 622
> >>                                                                avg =3D
> >> 2106.8
> >>                                                                max =3D
> >> 5286
> >>
> >>                                                 Wald chi2(2)       =3D
> >> 7.45
> >> Log likelihood  =3D -5965.7258                    Prob > chi2
>       =3D
> >> 0.0242
> >>
> >> -
> >>
> ------------------------------------------------------------------------=
> ----
> >>
> >> - --
> >>         case |         OR   Std. Err.      z    P>|z|     [95% Conf.
> >> Interval]
> >> -
> >>
> -------------+----------------------------------------------------------=
> ----
> >>
> >> - --
> >>  _Ialleles_1 |   1.050559   .1153838     0.45   0.653     .8470957
> >> 1.302893
> >>  _Ialleles_2 |   1.778091   .3759296     2.72   0.006     1.174871
> >> 2.691025
> >> -
> >>
> -------------+----------------------------------------------------------=
> ----
> >>
> >> - --
> >>     /lnsig2u |  -5.132952
> >> 1.966205                     -8.986643   -1.279262
> >> -
> >>
> -------------+----------------------------------------------------------=
> ----
> >>
> >> - --
> >>      sigma_u |   .0768057   .0755079                      .0111834
> >> .527487
> >>          rho |   .0017899    .003513                       .000038
> >> .0779804
> >> -
> >>
> ------------------------------------------------------------------------=
> ----
> >>
> >> - --
> >> Likelihood-ratio test of rho=3D0: chibar2(01) =3D  1.4e+04
> Prob >=3D chi=
> bar2 =3D
> >> 0.000
> >>
> >> The QQ vs RR OR is bigger than all but one of the study specific ORs,
> >> so is
> >> clearly wrong.
> >>
> >> So
> >>                      Metan        xtlogit
> >>
> >> Pooled OR RQ vs RR   0.98         1.05
> >>
> >> Pooled OR QQ vs RR   1.00         1.74
> >>
> >> Any ideas?
> >>
> >> Many thanks
> >>
> >> Paul Pharoah
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index