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

       log:  C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2003\class 15.log

  log type:  text

 opened on:  19 Nov 2003, 11:43:48

 

. set linesize 79

 

. use "C:\AAA Miker Files\newer web pages\soc_388_notes\Qian 80-90 intermar.dta

> ", clear

 

. *I'm going to use Qian's 80-90 intermarriage dataset, which has a lot of small

 values and zeros, and I'm going to estimate a model that doesn't fit very well.

. desmat: poisson count mfulleth*med4*year ffulleth*fed4*year med4*fed4

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

   Poisson regression

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

   Dependent variable                                                               count

   Optimization:                                                                       ml

   Number of observations:                                                            512

   Initial log likelihood:                                                   -1402408.286

   Log likelihood:                                                            -159490.084

   LR chi square:                                                             2485836.405

   Model degrees of freedom:                                                           70

   Pseudo R-squared:                                                                0.886

   Prob:                                                                            0.000

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

nr Effect                                                               Coeff        s.e.

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

   count

     mfulleth

1      Hisp                                                             5.733**     0.268

2      black                                                            5.891**     0.268

3      white                                                            7.874**     0.267

     med4

4      2                                                                0.787**     0.286

5      3                                                                0.482       0.279

6      4                                                               -0.797**     0.277

     mfulleth.med4

7      Hisp.2                                                          -1.657**     0.286

8      Hisp.3                                                          -2.862**     0.280

9      Hisp.4                                                          -4.208**     0.278

10     black.2                                                         -1.144**     0.286

11     black.3                                                         -2.383**     0.279

12     black.4                                                         -3.577**     0.277

13     white.2                                                         -0.765**     0.286

14     white.3                                                         -1.903**     0.279

15     white.4                                                         -2.367**     0.276

     year

16     90                                                              -0.511       0.579

     mfulleth.year

17     Hisp.90                                                          0.019       0.464

18     black.90                                                        -0.285       0.464

19     white.90                                                         0.286       0.463

     med4.year

20     2.90                                                            -0.446       0.504

21     3.90                                                            -0.299       0.482

22     4.90                                                            -0.419       0.477

     mfulleth.med4.year

23     Hisp.2.90                                                        0.492       0.505

24     Hisp.3.90                                                        0.578       0.484

25     Hisp.4.90                                                        0.155       0.480

26     black.2.90                                                       0.584       0.505

27     black.3.90                                                       0.672       0.483

28     black.4.90                                                       0.095       0.479

29     white.2.90                                                       0.256       0.504

30     white.3.90                                                       0.267       0.482

31     white.4.90                                                      -0.125       0.477

     ffulleth

32     Hisp                                                             5.344**     0.224

33     black                                                            5.356**     0.224

34     white                                                            7.489**     0.224

     fed4

35     2                                                                0.815**     0.238

36     3                                                                0.142       0.235

37     4                                                               -1.332**     0.236

     ffulleth.fed4

38     Hisp.2                                                          -1.591**     0.239

39     Hisp.3                                                          -2.809**     0.236

40     Hisp.4                                                          -4.194**     0.237

41     black.2                                                         -1.032**     0.239

42     black.3                                                         -1.982**     0.236

43     black.4                                                         -3.067**     0.235

44     white.2                                                         -0.660**     0.238

45     white.3                                                         -1.700**     0.235

46     white.4                                                         -2.285**     0.233

     ffulleth.year

47     Hisp.90                                                         -0.415       0.350

48     black.90                                                        -0.650       0.350

49     white.90                                                        -0.188       0.349

     fed4.year

50     2.90                                                            -1.002*      0.394

51     3.90                                                            -0.352       0.372

52     4.90                                                             0.177       0.364

     ffulleth.fed4.year

53     Hisp.2.90                                                        1.181**     0.395

54     Hisp.3.90                                                        1.398**     0.374

55     Hisp.4.90                                                        0.874*      0.369

56     black.2.90                                                       1.094**     0.395

57     black.3.90                                                       1.211**     0.373

58     black.4.90                                                       0.522       0.367

59     white.2.90                                                       0.899*      0.394

60     white.3.90                                                       0.995**     0.372

61     white.4.90                                                       0.402       0.365

     med4.fed4

62     2.2                                                              1.538**     0.010

63     2.3                                                              1.794**     0.015

64     2.4                                                              2.288**     0.035

65     3.2                                                              1.893**     0.015

66     3.3                                                              3.500**     0.018

67     3.4                                                              4.422**     0.035

68     4.2                                                              2.592**     0.034

69     4.3                                                              4.786**     0.035

70     4.4                                                              7.501**     0.046

71   _cons                                                             -5.887**     0.348

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

*  p < .05

** p < .01

 

. poisgof

 

         Goodness-of-fit chi2  =  316783.2

         Prob > chi2(441)      =    0.0000

 

. desmat: nbreg count mfulleth*med4*year ffulleth*fed4*year med4*fed4

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

   Negative binomial regression

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

   Dependent variable                                                               count

   Optimization:                                                                       ml

   Number of observations:                                                            512

   Initial log likelihood:                                                      -2722.660

   Log likelihood:                                                              -2417.521

   LR chi square:                                                                 610.277

   Model degrees of freedom:                                                           70

   Pseudo R-squared:                                                                0.112

   Dispersion:                                                                       mean

   Prob:                                                                            0.000

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

nr Effect                                                               Coeff        s.e.

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

   count

     mfulleth

1      Hisp                                                             5.136**     0.943

2      black                                                            5.391**     1.058

3      white                                                            5.930**     0.940

     med4

4      2                                                                2.109*      1.070

5      3                                                                1.392       1.085

6      4                                                               -0.145       1.109

     mfulleth.med4

7      Hisp.2                                                          -2.872*      1.143

8      Hisp.3                                                          -3.548**     1.154

9      Hisp.4                                                          -4.263**     1.169

10     black.2                                                         -2.341*      1.142

11     black.3                                                         -3.311**     1.152

12     black.4                                                         -3.859**     1.168

13     white.2                                                         -1.851       1.144

14     white.3                                                         -2.689*      1.151

15     white.4                                                         -2.633*      1.164

     year

16     90                                                              -2.565       1.457

     mfulleth.year

17     Hisp.90                                                          1.385       1.304

18     black.90                                                         1.212       1.475

19     white.90                                                         1.746       1.262

     med4.year

20     2.90                                                             0.652       1.434

21     3.90                                                             1.274       1.405

22     4.90                                                             1.573       1.428

     mfulleth.med4.year

23     Hisp.2.90                                                       -0.507       1.670

24     Hisp.3.90                                                       -0.994       1.645

25     Hisp.4.90                                                       -1.838       1.673

26     black.2.90                                                      -0.573       1.667

27     black.3.90                                                      -0.862       1.643

28     black.4.90                                                      -1.558       1.670

29     white.2.90                                                      -0.872       1.665

30     white.3.90                                                      -1.171       1.637

31     white.4.90                                                      -2.040       1.653

     ffulleth

32     Hisp                                                             4.450**     0.855

33     black                                                            4.271**     1.023

34     white                                                            5.435**     0.844

     fed4

35     2                                                                1.439       0.974

36     3                                                                0.759       0.998

37     4                                                               -0.558       1.023

     ffulleth.fed4

38     Hisp.2                                                          -1.950       1.042

39     Hisp.3                                                          -3.153**     1.060

40     Hisp.4                                                          -3.949**     1.085

41     black.2                                                         -1.579       1.045

42     black.3                                                         -2.339*      1.063

43     black.4                                                         -2.837**     1.086

44     white.2                                                         -1.125       1.045

45     white.3                                                         -2.234*      1.059

46     white.4                                                         -2.650*      1.081

     ffulleth.year

47     Hisp.90                                                          0.427       1.243

48     black.90                                                         0.410       1.454

49     white.90                                                         0.640       1.215

     fed4.year

50     2.90                                                            -1.494       1.292

51     3.90                                                             0.004       1.297

52     4.90                                                             0.038       1.340

     ffulleth.fed4.year

53     Hisp.2.90                                                        1.385       1.548

54     Hisp.3.90                                                        0.807       1.554

55     Hisp.4.90                                                        0.286       1.594

56     black.2.90                                                       1.272       1.551

57     black.3.90                                                       0.501       1.559

58     black.4.90                                                       0.230       1.600

59     white.2.90                                                       1.148       1.548

60     white.3.90                                                       0.508       1.553

61     white.4.90                                                       0.239       1.592

     med4.fed4

62     2.2                                                              1.438*      0.656

63     2.3                                                              1.688*      0.657

64     2.4                                                              1.612*      0.672

65     3.2                                                              1.817**     0.649

66     3.3                                                              3.409**     0.648

67     3.4                                                              4.062**     0.671

68     4.2                                                              2.186**     0.659

69     4.3                                                              4.402**     0.664

70     4.4                                                              6.830**     0.690

71   _cons                                                             -3.205**     1.050

   lnalpha

72   _cons                                                              1.042**     0.060

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

*  p < .05

** p < .01

 

. *That's the same model, with nbreg instead of poisson.  It has one extra term, the over-

> dispersion term lnalpha.

. *What's interesting here is how radically different the SE of the med4*fed4 terms are.

. If we get the direct nbreg output, which desmat initially suppresses.

unrecognized command:  If

r(199);

 

. nbreg count _x_*

 

Fitting Poisson model:

 

Iteration 0:   log likelihood = -2689974.6 

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

Iteration 2:   log likelihood = -1154089.9  (backed up)

Iteration 3:   log likelihood = -534181.21 

Iteration 4:   log likelihood = -308895.05 

Iteration 5:   log likelihood = -161058.51 

Iteration 6:   log likelihood = -159495.85 

Iteration 7:   log likelihood = -159490.08 

Iteration 8:   log likelihood = -159490.08 

 

Fitting constant-only model:

 

Iteration 0:   log likelihood = -4060.4348 

Iteration 1:   log likelihood = -2731.4998 

Iteration 2:   log likelihood = -2722.6662 

Iteration 3:   log likelihood = -2722.6601 

Iteration 4:   log likelihood = -2722.6601 

 

Fitting full model:

 

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

Iteration 1:   log likelihood = -2592.5781  (not concave)

Iteration 2:   log likelihood = -2512.3773 

Iteration 3:   log likelihood = -2472.7721 

Iteration 4:   log likelihood =  -2427.693 

Iteration 5:   log likelihood = -2417.7676 

Iteration 6:   log likelihood = -2417.5218 

Iteration 7:   log likelihood = -2417.5213 

Iteration 8:   log likelihood = -2417.5213 

 

Negative binomial regression                      Number of obs   =        512

                                                  LR chi2(70)     =     610.28

                                                  Prob > chi2     =     0.0000

Log likelihood = -2417.5213                       Pseudo R2       =     0.1121

 

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

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

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

        _x_1 |   5.135537   .9431738     5.44   0.000      3.28695    6.984124

        _x_2 |   5.391223   1.057818     5.10   0.000     3.317939    7.464507

        _x_3 |   5.929622   .9402622     6.31   0.000     4.086742    7.772502

        _x_4 |   2.109165   1.070128     1.97   0.049     .0117521    4.206578

        _x_5 |   1.392109   1.084754     1.28   0.199    -.7339689    3.518187

        _x_6 |  -.1452501   1.109393    -0.13   0.896    -2.319621    2.029121

        _x_7 |   -2.87222   1.143232    -2.51   0.012    -5.112913   -.6315275

        _x_8 |  -3.548247   1.154227    -3.07   0.002     -5.81049   -1.286004

        _x_9 |  -4.262664   1.169383    -3.65   0.000    -6.554614   -1.970715

       _x_10 |  -2.341135   1.142224    -2.05   0.040    -4.579854   -.1024162

       _x_11 |  -3.310937   1.151746    -2.87   0.004    -5.568317   -1.053557

       _x_12 |  -3.858745   1.167779    -3.30   0.001     -6.14755   -1.569939

       _x_13 |   -1.85068   1.144311    -1.62   0.106    -4.093489    .3921278

       _x_14 |  -2.688822   1.150703    -2.34   0.019    -4.944159   -.4334846

       _x_15 |  -2.632566    1.16385    -2.26   0.024    -4.913669   -.3514622

       _x_16 |  -2.565414   1.456543    -1.76   0.078    -5.420185    .2893569

       _x_17 |   1.385326   1.304149     1.06   0.288     -1.17076    3.941411

       _x_18 |   1.211602   1.474589     0.82   0.411     -1.67854    4.101743

       _x_19 |   1.745791   1.262248     1.38   0.167    -.7281686    4.219751

       _x_20 |   .6519337   1.433718     0.45   0.649    -2.158102     3.46197

       _x_21 |   1.274393   1.405239     0.91   0.364    -1.479825    4.028612

       _x_22 |   1.573442   1.427934     1.10   0.271    -1.225257    4.372141

       _x_23 |  -.5071242    1.66993    -0.30   0.761    -3.780128    2.765879

       _x_24 |  -.9935789   1.645023    -0.60   0.546    -4.217764    2.230606

       _x_25 |  -1.838472   1.672759    -1.10   0.272    -5.117019    1.440075

       _x_26 |  -.5729003    1.66705    -0.34   0.731    -3.840258    2.694458

       _x_27 |  -.8624201   1.642769    -0.52   0.600    -4.082189    2.357348

       _x_28 |   -1.55807   1.670022    -0.93   0.351    -4.831253    1.715113

       _x_29 |  -.8718762   1.665196    -0.52   0.601      -4.1356    2.391847

       _x_30 |  -1.170809   1.637108    -0.72   0.475    -4.379482    2.037864

       _x_31 |   -2.04004   1.653416    -1.23   0.217    -5.280676    1.200595

       _x_32 |   4.449884   .8545054     5.21   0.000     2.775084    6.124684

       _x_33 |   4.270677   1.022905     4.18   0.000      2.26582    6.275534

       _x_34 |   5.434985   .8443748     6.44   0.000     3.780041    7.089929

       _x_35 |   1.438952   .9741681     1.48   0.140    -.4703819    3.348287

       _x_36 |   .7591769   .9983391     0.76   0.447    -1.197532    2.715886

       _x_37 |  -.5583202   1.023069    -0.55   0.585    -2.563499    1.446859

       _x_38 |  -1.949838   1.041544    -1.87   0.061    -3.991226    .0915502

       _x_39 |  -3.153348   1.059797    -2.98   0.003    -5.230511   -1.076185

       _x_40 |  -3.948891   1.085297    -3.64   0.000    -6.076034   -1.821748

       _x_41 |  -1.579013   1.045123    -1.51   0.131    -3.627416    .4693897

       _x_42 |  -2.339241   1.063418    -2.20   0.028    -4.423502   -.2549793

       _x_43 |  -2.837092   1.085973    -2.61   0.009    -4.965561    -.708623

       _x_44 |  -1.125296   1.045337    -1.08   0.282    -3.174118     .923527

       _x_45 |  -2.234005   1.059009    -2.11   0.035    -4.309625   -.1583849

       _x_46 |  -2.649929   1.081231    -2.45   0.014    -4.769103   -.5307557

       _x_47 |    .427068   1.243119     0.34   0.731    -2.009401    2.863537

       _x_48 |   .4102428   1.454459     0.28   0.778    -2.440444     3.26093

       _x_49 |    .640423   1.215052     0.53   0.598    -1.741035    3.021881

       _x_50 |  -1.493797   1.292274    -1.16   0.248    -4.026607    1.039014

       _x_51 |   .0039871     1.2967     0.00   0.998    -2.537499    2.545473

       _x_52 |   .0377585   1.339818     0.03   0.978    -2.588236    2.663753

       _x_53 |   1.384957   1.547684     0.89   0.371    -1.648448    4.418361

       _x_54 |   .8073317   1.554281     0.52   0.603    -2.239002    3.853666

       _x_55 |   .2860036   1.594101     0.18   0.858    -2.838376    3.410383

       _x_56 |   1.271529   1.551448     0.82   0.412    -1.769253    4.312312

       _x_57 |   .5010196   1.558793     0.32   0.748    -2.554158    3.556197

       _x_58 |   .2297772   1.600047     0.14   0.886    -2.906257    3.365811

       _x_59 |   1.147584   1.547722     0.74   0.458    -1.885895    4.181062

       _x_60 |   .5076217   1.552895     0.33   0.744    -2.535997    3.551241

       _x_61 |   .2387873    1.59207     0.15   0.881    -2.881613    3.359187

       _x_62 |   1.437679   .6563954     2.19   0.029     .1511677     2.72419

       _x_63 |   1.687504    .656953     2.57   0.010     .3999003    2.975109

       _x_64 |    1.61244   .6715112     2.40   0.016     .2963028    2.928578

       _x_65 |   1.816864   .6488996     2.80   0.005     .5450438    3.088684

       _x_66 |   3.409369   .6476067     5.26   0.000     2.140083    4.678655

       _x_67 |   4.061697   .6708596     6.05   0.000     2.746836    5.376557

       _x_68 |   2.185599   .6593864     3.31   0.001      .893225    3.477972

       _x_69 |   4.401689   .6640965     6.63   0.000     3.100084    5.703294

       _x_70 |   6.829921     .69005     9.90   0.000     5.477448    8.182394

       _cons |  -3.205368   1.049949    -3.05   0.002     -5.26323   -1.147506

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

    /lnalpha |   1.041749   .0599969                      .9241569     1.15934

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

       alpha |   2.834169   .1700413                      2.519743     3.18783

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

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

 

. *We get a chisquare (here called chibar for a couple of technical reasons)

test of 310,000 or so.

. *log likelihood of the nbreg model is -2417

. *Log likelihood of the poisson model for the same variables is -159490

. display (-2*(-159490))-(-2*(-2417))

314146

 

. *the negative binomial version fits dramatically better here, and has some different things to say about educational intermarriage.

. *We have the difference of -2 log likelihood as 310,000

. exit, clear