log type:  text

 opened on:  10 Oct 2005, 11:01:55

 

. table wed hed, contents(mean  endogdm)

 

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

          |          hed         

      wed |    1     2     3     4

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

        1 |    1     0     0     0

        2 |    0     1     0     0

        3 |    0     0     1     0

        4 |    0     0     0     1

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

 

. table wed hed, contents (mean endog)

 

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

          |          hed         

      wed |    1     2     3     4

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

        1 |    1     0     0     0

        2 |    0     2     0     0

        3 |    0     0     3     0

        4 |    0     0     0     4

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

 

. desmat: poisson count wed hed  endogdm

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

   Poisson regression

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

   Dependent variable                                                               count

   Optimization:                                                                       ml

   Number of observations:                                                             16

   Initial log likelihood:                                                    -221501.223

   Log likelihood:                                                             -41944.565

   LR chi square:                                                              359113.316

   Model degrees of freedom:                                                            7

   Pseudo R-squared:                                                                0.811

   Prob:                                                                            0.000

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

nr Effect                                                               Coeff        s.e.

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

   count

     wed

1      2                                                                0.979**     0.005

2      3                                                                0.608**     0.005

3      4                                                                0.081**     0.005

     hed

4      2                                                                0.740**     0.005

5      3                                                                0.414**     0.005

6      4                                                                0.216**     0.005

     endogdm

7      1                                                                1.115**     0.003

8    _cons                                                              9.067**     0.005

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

*  p < .05

** p < .01

 

. set linesize 79

 

. desmat: poisson count wed hed  endog

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

   Poisson regression

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

   Dependent variable                                                    count

   Optimization:                                                            ml

   Number of observations:                                                  16

   Initial log likelihood:                                         -221501.223

   Log likelihood:                                                  -24059.274

   LR chi square:                                                   394883.898

   Model degrees of freedom:                                                10

   Pseudo R-squared:                                                     0.891

   Prob:                                                                 0.000

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

nr Effect                                                    Coeff        s.e.

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

   count

     wed

1      2                                                     1.372**     0.007

2      3                                                     1.020**     0.007

3      4                                                    -0.278**     0.008

     hed

4      2                                                     1.134**     0.007

5      3                                                     0.819**     0.006

6      4                                                    -0.017*      0.007

     endog

7      1                                                     1.722**     0.009

8      2                                                     0.676**     0.007

9      3                                                     0.537**     0.008

10     4                                                     2.487**     0.009

11   _cons                                                   8.652**     0.008

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

*  p < .05

** p < .01

 

. poisgof

 

         Goodness-of-fit chi2  =  47932.55

         Prob > chi2(5)        =    0.0000

 

. display 83703-47932

35771

 

. display chi2tail(3,35771)

0

 

. display chi2tail(3,100)

1.554e-21

 

. lincom _x_7-_x_9

 

 ( 1)  [count]_x_7 - [count]_x_9 = 0

 

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

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

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

         (1) |   1.184561   .0123912    95.60   0.000     1.160275    1.208847

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

 

. *Note: We know because the model with 4 endogamy terms fits much better than

the model with 1 endogamy term, that educational endogamy varies across educational groups.

 

. *In order to say which level of educational endogamy is the highest, we can compare the coefficients, and test them.

 

. table hed wed, contents (mean eddiff3)

 

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

          |          wed         

      hed |    1     2     3     4

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

        1 |    0     0     0     1

        2 |    0     0     0     0

        3 |    0     0     0     0

        4 |    1     0     0     0

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

 

. desmat: poisson count wed hed  endog  eddiff3

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

   Poisson regression

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

   Dependent variable                                                    count

   Optimization:                                                            ml

   Number of observations:                                                  16

   Initial log likelihood:                                         -221501.223

   Log likelihood:                                                  -17940.195

   LR chi square:                                                   407122.056

   Model degrees of freedom:                                                11

   Pseudo R-squared:                                                     0.919

   Prob:                                                                 0.000

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

nr Effect                                                    Coeff        s.e.

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

   count

     wed

1      2                                                     1.132**     0.007

2      3                                                     0.815**     0.007

3      4                                                    -0.276**     0.008

     hed

4      2                                                     0.942**     0.007

5      3                                                     0.667**     0.007

6      4                                                     0.009       0.007

     endog

7      1                                                     1.410**     0.010

8      2                                                     0.796**     0.007

9      3                                                     0.583**     0.007

10     4                                                     2.147**     0.010

     eddiff3

11     1                                                    -1.947**     0.023

12   _cons                                                   8.964**     0.008

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

*  p < .05

** p < .01

 

. poisgof

 

         Goodness-of-fit chi2  =  35694.39

         Prob > chi2(4)        =    0.0000

 

. *That's an improvement in the LRT goodness of fit on 1 df from the

. *previous model, but it is still far, far away from the actual data

. desmat: poisson count wed hed  endog  eddiff3 eddiff2

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

   Poisson regression

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

   Dependent variable                                                    count

   Optimization:                                                            ml

   Number of observations:                                                  16

   Initial log likelihood:                                         -221501.223

   Log likelihood:                                                    -145.628

   LR chi square:                                                   442711.189

   Model degrees of freedom:                                                12

   Pseudo R-squared:                                                     0.999

   Prob:                                                                 0.000

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

nr Effect                                                    Coeff        s.e.

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

   count

     wed

1      2                                                     0.817**     0.008

2      3                                                     0.461**     0.007

3      4                                                    -0.142**     0.009

     hed

4      2                                                     0.627**     0.008

5      3                                                     0.355**     0.007

6      4                                                     0.180**     0.008

     endog

7      1                                                     0.763**     0.011

8      2                                                     0.779**     0.007

9      3                                                     0.601**     0.008

10     4                                                     1.195**     0.011

     eddiff3

11     1                                                    -2.749**     0.024

     eddiff2

12     1                                                    -1.068**     0.006

13   _cons                                                   9.611**     0.009

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

*  p < .05

** p < .01

 

. poisgof

 

         Goodness-of-fit chi2  =  105.2568

         Prob > chi2(3)        =    0.0000

 

. table hed wed, contents (mean eddiff2)

 

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

          |          wed         

      hed |    1     2     3     4

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

        1 |    0     0     1     0

        2 |    0     0     0     1

        3 |    1     0     0     0

        4 |    0     1     0     0

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

 

. *let's take a look at how this model fits.

. predict M6

(option n assumed; predicted number of events)

 

. table hed wed, contents (sum count sum M6) row col

 

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

          |                       wed                      

      hed |        1         2         3         4     Total

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

        1 |    32016     33374      8407       988     74785

          |    32016  33801.72  8138.919  828.3573     74785

          |

        2 |    28370    137876     43783      8446    218475

          | 27942.28    137876  44327.54  8329.189    218475

          |

        3 |     7051     48766     61633     18195    135645

          | 7319.081  48221.46     61633  18471.45    135645

          |

        4 |      984     13794     28635     51224     94637

          | 1143.643  13910.81  28358.55     51224     94637

          |

    Total |    68421    233810    142458     78853    523542

          |    68421    233810    142458     78853    523542

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

 

. *One way to look at this is the simple residuals

. gen M6_resid=M6-count

 

. table hed wed, contents (sum  M6_resid)

 

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

          |                    wed                   

      hed |         1          2          3          4

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

        1 |         0   427.7227  -268.0806  -159.6427

        2 | -427.7227          0   544.5352  -116.8105

        3 |  268.0806  -544.5352          0   276.4531

        4 |  159.6427   116.8105  -276.4531          0

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

 

. table hed wed, contents (sum  M6_resid) row col

 

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

          |                          wed                        

      hed |         1          2          3          4      Total

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

        1 |         0   427.7227  -268.0806  -159.6427  -.0006104

        2 | -427.7227          0   544.5352  -116.8105   .0019531

        3 |  268.0806  -544.5352          0   276.4531  -.0014648

        4 |  159.6427   116.8105  -276.4531          0   .0001221

          |

    Total |  .0006104  -.0019531   .0014648  -.0001221          0

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

 

. *one simple way to standardize the residuals is to use the Pearson residuals

. poisgof, pearson

 

         Goodness-of-fit chi2  =  105.9502

         Prob > chi2(3)        =    0.0000

 

. gen M6_pearson_resid= (M6_resid^2)/ M6

 

. table hed wed, contents (sum M6_pearson_resid) row col

 

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

          |                       wed                      

      hed |        1         2         3         4     Total

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

        1 |        0  5.412347  8.830066  30.76666  45.00908

        2 | 6.547307         0  6.689263  1.638179  14.87475

        3 | 9.819156  6.149098         0  4.137537  20.10579

        4 | 22.28475  .9808705  2.695002         0  25.96062

          |

    Total | 38.65121  12.54232  18.21433  36.54238  105.9502

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

 

. * Here is a clue to where we might try to apply another degree of freedom into our model- the two furthest out cells, where education =(1,4) and (4,1) fit poorly and contribute a lot to our pearson chisquare test. One additional term would fit both exactly, because we already have one term for these two cells (eddiff3) in the model.

 

 

. log close

  log type:  text

 closed on:  10 Oct 2005, 11:56:25

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