---------------------------------------------------------------------------------

       log:  C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2007\class_

> 17_log.log

  log type:  text

 opened on:  27 Nov 2007, 11:34:18

 

. *A quick log about negative binomial and loglinear models.

 

. desmat: poisson  count frace*fed6  mrace*med6 rendog blendog BW @BWsce

------------------------------------------------------------------------------

   Poisson regression

------------------------------------------------------------------------------

   Dependent variable                                                   count

   Optimization:                                                           ml

   Number of observations:                                                324

   Initial log likelihood:                                       -1335369.103

   Log likelihood:                                                -139712.934

   LR chi square:                                                 2391312.338

   Model degrees of freedom:                                               38

   Pseudo R-squared:                                                    0.895

   Prob:                                                                0.000

------------------------------------------------------------------------------

nr Effect                                                   Coeff        s.e.

------------------------------------------------------------------------------

   count

     frace

1      NH Black                                            -3.412**     0.049

2      All Others                                          -0.708**     0.017

     fed6

3      10,11                                                0.342**     0.008

4      HS                                                   2.069**     0.006

5      Some col                                             1.326**     0.007

6      BA                                                   0.765**     0.007

7      >BA                                                  0.115**     0.008

     frace.fed6

8      NH Black.10,11                                       0.030       0.021

9      NH Black.HS                                         -0.507**     0.017

10     NH Black.Some col                                   -0.492**     0.019

11     NH Black.BA                                         -0.998**     0.023

12     NH Black.>BA                                        -0.977**     0.028

13     All Others.10,11                                    -0.361**     0.023

14     All Others.HS                                       -1.029**     0.019

15     All Others.Some col                                 -1.129**     0.022

16     All Others.BA                                       -1.814**     0.031

17     All Others.>BA                                      -1.541**     0.036

     mrace

18     NH Black                                            -1.959**     0.038

19     All Others                                          -0.821**     0.017

     med6

20     10,11                                                0.137**     0.008

21     HS                                                   1.782**     0.006

22     Some col                                             1.223**     0.006

23     BA                                                   0.739**     0.007

24     >BA                                                  0.559**     0.007

     mrace.med6

25     NH Black.10,11                                       0.034       0.019

26     NH Black.HS                                         -0.584**     0.015

27     NH Black.Some col                                   -0.721**     0.017

28     NH Black.BA                                         -1.422**     0.023

29     NH Black.>BA                                        -1.716**     0.026

30     All Others.10,11                                    -0.161**     0.024

31     All Others.HS                                       -0.815**     0.019

32     All Others.Some col                                 -0.840**     0.021

33     All Others.BA                                       -1.584**     0.029

34     All Others.>BA                                      -1.512**     0.030

     rendog

35     1                                                    2.291**     0.008

     blendog

36     1                                                    4.204**     0.073

     BW

37     1                                                   -0.546**     0.039

38   BWsce                                                  0.136**     0.012

39   _cons                                                  5.226**     0.011

------------------------------------------------------------------------------

*  p < .05

** p < .01

 

. poisgof

 

         Goodness-of-fit chi2  =  277491.9

         Prob > chi2(285)      =    0.0000

 

. *This is the Model 1 loglinear model from my AJS paper. Note the positive and significant BWsce (Black white status caste exchange) term.

. desmat: nbreg  count frace*fed6  mrace*med6 rendog blendog BW @BWsce, verbose

 

Desmat generated the following design matrix:

 

nr   Variables       Term                        Parameterization

     First    Last

 

 1    _x_1    _x_2   frace                       ind(1)

 2    _x_3    _x_7   fed6                        ind(1)

 3    _x_8   _x_17   frace.fed6                  ind(1).ind(1)

 4   _x_18   _x_19   mrace                       ind(1)

 5   _x_20   _x_24   med6                        ind(1)

 6   _x_25   _x_34   mrace.med6                  ind(1).ind(1)

 7   _x_35           rendog                      ind(0)

 8   _x_36           blendog                     ind(0)

 9   _x_37           BW                          ind(0)

10   _x_38           BWsce                       direct

 

Fitting Poisson model:

 

Iteration 0:   log likelihood = -1785213.3 

Iteration 1:   log likelihood = -1335702.9  (backed up)

Iteration 2:   log likelihood = -1072685.9 

Iteration 3:   log likelihood = -420545.17 

Iteration 4:   log likelihood = -177722.64 

Iteration 5:   log likelihood = -140348.62 

Iteration 6:   log likelihood = -139713.77 

Iteration 7:   log likelihood = -139712.93 

Iteration 8:   log likelihood = -139712.93 

 

Fitting constant-only model:

 

Iteration 0:   log likelihood = -2750.3011 

Iteration 1:   log likelihood = -2216.8924 

Iteration 2:   log likelihood = -2216.8896 

Iteration 3:   log likelihood = -2216.8896 

 

Fitting full model:

 

Iteration 0:   log likelihood = -2154.7704  (not concave)

Iteration 1:   log likelihood = -2034.0179 

Iteration 2:   log likelihood = -1992.6755 

Iteration 3:   log likelihood = -1941.2353 

Iteration 4:   log likelihood = -1853.3137 

Iteration 5:   log likelihood = -1852.3806 

Iteration 6:   log likelihood = -1852.3774 

Iteration 7:   log likelihood = -1852.3774 

 

Negative binomial regression                      Number of obs   =        324

                                                  LR chi2(38)     =     729.02

                                                  Prob > chi2     =     0.0000

Log likelihood = -1852.3774                       Pseudo R2       =     0.1644

 

------------------------------------------------------------------------------

       count |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]

-------------+----------------------------------------------------------------

        _x_1 |   -3.54226   .3671344    -9.65   0.000    -4.261831    -2.82269

        _x_2 |  -1.143256   .3275539    -3.49   0.000     -1.78525   -.5012625

        _x_3 |   .3411358   .3214777     1.06   0.289    -.2889489    .9712205

        _x_4 |   1.617797   .3258008     4.97   0.000     .9792392    2.256355

        _x_5 |   1.015074   .3359433     3.02   0.003     .3566369     1.67351

        _x_6 |   .4092661    .347168     1.18   0.238    -.2711706    1.089703

        _x_7 |  -.0381025   .3572391    -0.11   0.915    -.7382783    .6620733

        _x_8 |   .0191493   .4663474     0.04   0.967    -.8948748    .9331734

        _x_9 |  -.3327831   .4625601    -0.72   0.472    -1.239384     .573818

       _x_10 |  -.1818947    .467158    -0.39   0.697    -1.097508    .7337181

       _x_11 |  -.6255032   .4753208    -1.32   0.188    -1.557115    .3061085

       _x_12 |  -.5304081     .48833    -1.09   0.277    -1.487517    .4267012

       _x_13 |  -.3094955    .453883    -0.68   0.495     -1.19909    .5800989

       _x_14 |  -.6454152   .4537051    -1.42   0.155    -1.534661    .2438303

       _x_15 |  -.6475651   .4565164    -1.42   0.156    -1.542321    .2471907

       _x_16 |  -1.116904   .4595527    -2.43   0.015    -2.017611   -.2161974

       _x_17 |  -1.121978    .466346    -2.41   0.016       -2.036   -.2079567

       _x_18 |  -2.144572    .369716    -5.80   0.000    -2.869202   -1.419942

       _x_19 |  -.8657121   .3371297    -2.57   0.010    -1.526474   -.2049501

       _x_20 |   .0486761   .3283103     0.15   0.882    -.5948003    .6921525

       _x_21 |   1.364141   .3305427     4.13   0.000     .7162892    2.011993

       _x_22 |   1.025122   .3393403     3.02   0.003     .3600274    1.690217

       _x_23 |   .7357188   .3496288     2.10   0.035     .0504589    1.420979

       _x_24 |   1.098691   .3597084     3.05   0.002     .3936753    1.803706

       _x_25 |   .1557508   .4615805     0.34   0.736    -.7489303    1.060432

       _x_26 |  -.2930492   .4610576    -0.64   0.525    -1.196706    .6106071

       _x_27 |  -.2825236   .4639913    -0.61   0.543     -1.19193    .6268826

       _x_28 |  -.9211377   .4720356    -1.95   0.051     -1.84631    .0040351

       _x_29 |  -1.275697    .481366    -2.65   0.008    -2.219157   -.3322372

       _x_30 |  -.1053643   .4646886    -0.23   0.821    -1.016137    .8054086

       _x_31 |  -.6205033   .4618318    -1.34   0.179    -1.525677    .2846704

       _x_32 |  -.6304821    .464632    -1.36   0.175    -1.541144    .2801799

       _x_33 |  -1.337587   .4705215    -2.84   0.004    -2.259792   -.4153817

       _x_34 |  -1.439732   .4750442    -3.03   0.002    -2.370801   -.5086626

       _x_35 |   2.276199   .1601957    14.21   0.000     1.962222    2.590177

       _x_36 |   4.065725   .4047264    10.05   0.000     3.272475    4.858974

       _x_37 |  -.6528239   .2048047    -3.19   0.001    -1.054234   -.2514141

       _x_38 |   .0450504    .083835     0.54   0.591    -.1192633    .2093641

       _cons |   5.599588   .3222667    17.38   0.000     4.967957    6.231219

-------------+----------------------------------------------------------------

    /lnalpha |  -.1060076   .0771399                     -.2571991    .0451839

-------------+----------------------------------------------------------------

       alpha |   .8994178    .069381                      .7732142     1.04622

------------------------------------------------------------------------------

Likelihood-ratio test of alpha=0:  chibar2(01) = 2.8e+05 Prob>=chibar2 = 0.000

------------------------------------------------------------------------------

   Negative binomial regression

------------------------------------------------------------------------------

   Dependent variable                                                   count

   Optimization:                                                           ml

   Number of observations:                                                324

   Initial log likelihood:                                          -2216.890

   Log likelihood:                                                  -1852.377

   LR chi square:                                                     729.025

   Model degrees of freedom:                                               38

   Pseudo R-squared:                                                    0.164

   Dispersion:                                                           mean

   Prob:                                                                0.000

------------------------------------------------------------------------------

nr Effect                                                   Coeff        s.e.

------------------------------------------------------------------------------

   count

     frace

1      NH Black                                            -3.542**     0.367

2      All Others                                          -1.143**     0.328

     fed6

3      10,11                                                0.341       0.321

4      HS                                                   1.618**     0.326

5      Some col                                             1.015**     0.336

6      BA                                                   0.409       0.347

7      >BA                                                 -0.038       0.357

     frace.fed6

8      NH Black.10,11                                       0.019       0.466

9      NH Black.HS                                         -0.333       0.463

10     NH Black.Some col                                   -0.182       0.467

11     NH Black.BA                                         -0.626       0.475

12     NH Black.>BA                                        -0.530       0.488

13     All Others.10,11                                    -0.309       0.454

14     All Others.HS                                       -0.645       0.454

15     All Others.Some col                                 -0.648       0.457

16     All Others.BA                                       -1.117*      0.460

17     All Others.>BA                                      -1.122*      0.466

     mrace

18     NH Black                                            -2.145**     0.370

19     All Others                                          -0.866*      0.337

     med6

20     10,11                                                0.049       0.328

21     HS                                                   1.364**     0.331

22     Some col                                             1.025**     0.339

23     BA                                                   0.736*      0.350

24     >BA                                                  1.099**     0.360

     mrace.med6

25     NH Black.10,11                                       0.156       0.462

26     NH Black.HS                                         -0.293       0.461

27     NH Black.Some col                                   -0.283       0.464

28     NH Black.BA                                         -0.921       0.472

29     NH Black.>BA                                        -1.276**     0.481

30     All Others.10,11                                    -0.105       0.465

31     All Others.HS                                       -0.621       0.462

32     All Others.Some col                                 -0.630       0.465

33     All Others.BA                                       -1.338**     0.471

34     All Others.>BA                                      -1.440**     0.475

     rendog

35     1                                                    2.276**     0.160

     blendog

36     1                                                    4.066**     0.405

     BW

37     1                                                   -0.653**     0.205

38   BWsce                                                  0.045       0.084

39   _cons                                                  5.600**     0.322

   lnalpha

40   _cons                                                 -0.106       0.077

------------------------------------------------------------------------------

*  p < .05

** p < .01

 

. *The negative binomial version of M1 totally erases what was a significant and positive finding for the status-caste exchange variable.

. *And nbreg fits dramatically better, adding one additional term.

. desmat: poisson  count frace*fed6  mrace*med6 med6*fed6 rendog blendog BW @B

> Wsce

------------------------------------------------------------------------------

   Poisson regression

------------------------------------------------------------------------------

   Dependent variable                                                   count

   Optimization:                                                           ml

   Number of observations:                                                324

   Initial log likelihood:                                       -1335369.103

   Log likelihood:                                                  -2153.154

   LR chi square:                                                 2666431.898

   Model degrees of freedom:                                               63

   Pseudo R-squared:                                                    0.998

   Prob:                                                                0.000

------------------------------------------------------------------------------

nr Effect                                                   Coeff        s.e.

------------------------------------------------------------------------------

   count

     frace

1      NH Black                                            -3.868**     0.050

2      All Others                                          -0.931**     0.018

     fed6

3      10,11                                               -0.441**     0.014

4      HS                                                   0.237**     0.012

5      Some col                                            -1.613**     0.021

6      BA                                                  -3.226**     0.046

7      >BA                                                 -3.938**     0.063

     frace.fed6

8      NH Black.10,11                                       0.117**     0.021

9      NH Black.HS                                         -0.204**     0.018

10     NH Black.Some col                                    0.063**     0.021

11     NH Black.BA                                         -0.110**     0.026

12     NH Black.>BA                                         0.063*      0.031

13     All Others.10,11                                    -0.290**     0.023

14     All Others.HS                                       -0.835**     0.020

15     All Others.Some col                                 -0.835**     0.023

16     All Others.BA                                       -1.387**     0.032

17     All Others.>BA                                      -1.085**     0.037

     mrace

18     NH Black                                            -2.055**     0.038

19     All Others                                          -1.057**     0.018

     med6

20     10,11                                               -0.592**     0.015

21     HS                                                  -0.021       0.013

22     Some col                                            -1.607**     0.022

23     BA                                                  -3.300**     0.049

24     >BA                                                 -3.669**     0.059

     mrace.med6

25     NH Black.10,11                                       0.046*      0.019

26     NH Black.HS                                         -0.524**     0.016

27     NH Black.Some col                                   -0.700**     0.019

28     NH Black.BA                                         -1.405**     0.025

29     NH Black.>BA                                        -1.723**     0.029

30     All Others.10,11                                    -0.076**     0.024

31     All Others.HS                                       -0.601**     0.020

32     All Others.Some col                                 -0.554**     0.022

33     All Others.BA                                       -1.202**     0.030

34     All Others.>BA                                      -1.105**     0.032

     med6.fed6

35     10,11.10,11                                          0.927**     0.020

36     10,11.HS                                             0.946**     0.017

37     10,11.Some col                                       1.067**     0.028

38     10,11.BA                                             0.800**     0.062

39     10,11.>BA                                            0.623**     0.089

40     HS.10,11                                             1.085**     0.017

41     HS.HS                                                2.298**     0.015

42     HS.Some col                                          2.680**     0.024

43     HS.BA                                                2.868**     0.048

44     HS.>BA                                               2.506**     0.066

45     Some col.10,11                                       1.232**     0.028

46     Some col.HS                                          2.904**     0.023

47     Some col.Some col                                    4.582**     0.029

48     Some col.BA                                          5.043**     0.050

49     Some col.>BA                                         4.763**     0.067

50     BA.10,11                                             1.002**     0.063

51     BA.HS                                                3.493**     0.051

52     BA.Some col                                          5.626**     0.053

53     BA.BA                                                7.368**     0.067

54     BA.>BA                                               6.899**     0.080

55     >BA.10,11                                            0.615**     0.081

56     >BA.HS                                               3.081**     0.061

57     >BA.Some col                                         5.576**     0.063

58     >BA.BA                                               7.465**     0.075

59     >BA.>BA                                              8.163**     0.086

     rendog

60     1                                                    2.261**     0.008

     blendog

61     1                                                    4.320**     0.073

     BW

62     1                                                   -0.541**     0.039

63   BWsce                                                  0.070**     0.018

64   _cons                                                  6.949**     0.012

------------------------------------------------------------------------------

*  p < .05

** p < .01

 

. poisgof

 

         Goodness-of-fit chi2  =  2372.308

         Prob > chi2(260)      =    0.0000

 

That’s loglinear model 2.

 

. desmat: nbreg  count frace*fed6  mrace*med6 med6*fed6 rendog blendog BW @BWsce

------------------------------------------------------------------------------

   Negative binomial regression

------------------------------------------------------------------------------

   Dependent variable                                                   count

   Optimization:                                                           ml

   Number of observations:                                                324

   Initial log likelihood:                                          -2216.890

   Log likelihood:                                                  -1427.298

   LR chi square:                                                    1579.182

   Model degrees of freedom:                                               63

   Pseudo R-squared:                                                    0.356

   Dispersion:                                                           mean

   Prob:                                                                0.000

------------------------------------------------------------------------------

nr Effect                                                   Coeff        s.e.

------------------------------------------------------------------------------

   count

     frace

1      NH Black                                            -3.627**     0.116

2      All Others                                          -1.021**     0.084

     fed6

3      10,11                                               -0.313*      0.126

4      HS                                                   0.312*      0.123

5      Some col                                            -1.243**     0.133

6      BA                                                  -2.929**     0.152

7      >BA                                                 -3.412**     0.166

     frace.fed6

8      NH Black.10,11                                       0.010       0.134

9      NH Black.HS                                         -0.358**     0.126

10     NH Black.Some col                                   -0.105       0.128

11     NH Black.BA                                         -0.317*      0.134

12     NH Black.>BA                                        -0.255       0.140

13     All Others.10,11                                    -0.341**     0.116

14     All Others.HS                                       -0.749**     0.110

15     All Others.Some col                                 -0.745**     0.112

16     All Others.BA                                       -1.194**     0.120

17     All Others.>BA                                      -1.120**     0.126

     mrace

18     NH Black                                            -1.981**     0.105

19     All Others                                          -0.972**     0.090

     med6

20     10,11                                               -0.486**     0.130

21     HS                                                   0.175       0.127

22     Some col                                            -1.141**     0.136

23     BA                                                  -2.872**     0.159

24     >BA                                                 -3.120**     0.169

     mrace.med6

25     NH Black.10,11                                       0.043       0.123

26     NH Black.HS                                         -0.467**     0.117

27     NH Black.Some col                                   -0.516**     0.120

28     NH Black.BA                                         -1.121**     0.127

29     NH Black.>BA                                        -1.338**     0.133

30     All Others.10,11                                    -0.147       0.125

31     All Others.HS                                       -0.585**     0.118

32     All Others.Some col                                 -0.542**     0.119

33     All Others.BA                                       -1.178**     0.125

34     All Others.>BA                                      -1.154**     0.127

     med6.fed6

35     10,11.10,11                                          0.924**     0.154

36     10,11.HS                                             0.998**     0.152

37     10,11.Some col                                       1.048**     0.165

38     10,11.BA                                             0.853**     0.197

39     10,11.>BA                                            0.302       0.218

40     HS.10,11                                             1.067**     0.152

41     HS.HS                                                2.150**     0.148

42     HS.Some col                                          2.370**     0.158

43     HS.BA                                                2.595**     0.181

44     HS.>BA                                               2.012**     0.195

45     Some col.10,11                                       1.149**     0.164

46     Some col.HS                                          2.587**     0.157

47     Some col.Some col                                    3.997**     0.165

48     Some col.BA                                          4.419**     0.185

49     Some col.>BA                                         4.168**     0.198

50     BA.10,11                                             1.060**     0.202

51     BA.HS                                                3.225**     0.183

52     BA.Some col                                          5.027**     0.189

53     BA.BA                                                6.695**     0.203

54     BA.>BA                                               6.210**     0.216

55     >BA.10,11                                            0.492*      0.220

56     >BA.HS                                               2.830**     0.194

57     >BA.Some col                                         4.914**     0.198

58     >BA.BA                                               6.829**     0.212

59     >BA.>BA                                              7.477**     0.221

     rendog

60     1                                                    2.202**     0.037

     blendog

61     1                                                    4.162**     0.125

     BW

62     1                                                   -0.608**     0.067

63   BWsce                                                  0.015       0.025

64   _cons                                                  6.708**     0.105

   lnalpha

65   _cons                                                 -3.250**     0.122

------------------------------------------------------------------------------

*  p < .05

** p < .01

 

* And that’s the nbreg version of model 2, which again erases the significance of the BWsce term.