log type: text
opened on: 5 Oct 2005, 11:11:35
. linesize 79
unrecognized command: linesize
r(199);
. set linesize 79
. desmat: poisson count hed wed
-------------------------------------------------------------------------------
Poisson regression
-------------------------------------------------------------------------------
Dependent variable count
Optimization: ml
Number of observations: 16
Initial log likelihood: -221501.223
Log likelihood: -113882.425
LR chi square: 215237.595
Model degrees of freedom: 6
Pseudo R-squared: 0.486
Prob: 0.000
-------------------------------------------------------------------------------
nr Effect Coeff s.e.
-------------------------------------------------------------------------------
count
hed
1 2 1.072** 0.004
2 3 0.595** 0.005
3 4 0.235** 0.005
wed
4 2 1.229** 0.004
5 3 0.733** 0.005
6 4 0.142** 0.005
7 _cons 9.187** 0.005
-------------------------------------------------------------------------------
* p < .05
** p < .01
. poisgof
Goodness-of-fit chi2 = 227578.9
Prob > chi2(9) = 0.0000
. predict P_independence
(option n assumed; predicted number of events)
. table hed wed, contents (sum count sum P_independence) row col
------------------------------------------------------------
| wed
hed | 1 2 3 4 Total
----------+-------------------------------------------------
1 | 32016 33374 8407 988 74785
| 9773.551 33398.43 20349.32 11263.7 74785
|
2 | 28370 137876 43783 8446 218475
| 28552.2 97569.33 59447.98 32905.5 218475
|
3 | 7051 48766 61633 18195 135645
| 17727.26 60578.06 36909.58 20430.1 135645
|
4 | 984 13794 28635 51224 94637
| 12367.98 42264.19 25751.13 14253.7 94637
|
Total | 68421 233810 142458 78853 523542
| 68421 233810 142458 78853 523542
------------------------------------------------------------
. *The independence model fits the marginals exactly
. *Now let's look at a model with one interaction term,
for educational endogamy
. gen ed_endog=0
. replace ed_endog=1 if hed==wed
(4 real changes made)
. table hed wed, contents (mean ed_endog)
----------------------------------
| wed
hed | 1 2 3 4
----------+-----------------------
1 | 1 0 0 0
2 | 0 1 0 0
3 | 0 0 1 0
4 | 0 0 0 1
----------------------------------
. desmat: poisson count hed wed ed_endog
-------------------------------------------------------------------------------
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
hed
1 2 0.740** 0.005
2 3 0.414** 0.005
3 4 0.216** 0.005
wed
4 2 0.979** 0.005
5 3 0.608** 0.005
6 4 0.081** 0.005
ed_endog
7 1 1.115** 0.003
8 _cons 9.067** 0.005
-------------------------------------------------------------------------------
* p < .05
** p < .01
. poisgof
Goodness-of-fit chi2 = 83703.13
Prob > chi2(8) = 0.0000
. predict P_edendog
(option n assumed; predicted number of events)
. table hed wed, contents (sum count sum P_independence sum P_edendog) row col
------------------------------------------------------------
| wed
hed | 1 2 3 4 Total
----------+-------------------------------------------------
1 | 32016 33374 8407 988 74785
| 9773.551 33398.43 20349.32 11263.7 74785
| 26426.32 23047.51 15915.36 9395.808 74785
|
2 | 28370 137876 43783 8446 218475
| 28552.2 97569.33 59447.98 32905.5 218475
| 18145.71 147304.7 33341.21 19683.35 218475
|
3 | 7051 48766 61633 18195 135645
| 17727.26 60578.06 36909.58 20430.1 135645
| 13104.12 34867.67 73458.66 14214.54 135645
|
4 | 984 13794 28635 51224 94637
| 12367.98 42264.19 25751.13 14253.7 94637
| 10744.85 28590.09 19742.76 35559.3 94637
|
Total | 68421 233810 142458 78853 523542
| 68421 233810 142458 78853 523542
| 68421 233810 142458 78853 523542
------------------------------------------------------------
. table hed wed if hed==wed, contents (sum count sum P_independence sum P_edendog) row col
------------------------------------------------------------
| wed
hed | 1 2 3 4 Total
----------+-------------------------------------------------
1 | 32016 32016
| 9773.551 9773.551
| 26426.32 26426.32
|
2 | 137876 137876
| 97569.33 97569.33
| 147304.7 147304.7
|
3 | 61633 61633
| 36909.58 36909.58
| 73458.66 73458.66
|
4 | 51224 51224
| 14253.7 14253.7
| 35559.3 35559.3
|
Total | 32016 137876 61633 51224 282749
| 9773.551 97569.33 36909.58 14253.7 158506.2
| 26426.32 147304.7 73458.66 35559.3 282749
------------------------------------------------------------
. *The ed endogamy model, with its one term to fit 4 cells of the endogamy
diagonal, gives the same total ( 282749) for those 4 cells as the actual data
. table hed wed if hed==wed, contents (sum count sum P_edendog) row col
------------------------------------------------------------
| wed
hed | 1 2 3 4 Total
----------+-------------------------------------------------
1 | 32016 32016
| 26426.32 26426.32
|
2 | 137876 137876
| 147304.7 147304.7
|
3 | 61633 61633
| 73458.66 73458.66
|
4 | 51224 51224
| 35559.3 35559.3
|
Total | 32016 137876 61633 51224 282749
| 26426.32 147304.7 73458.66 35559.3 282749
------------------------------------------------------------
. *to test whether the force of educational endogamy depends on how much
education you have, let's make a graduated interaction for the diagonal cells
. gen ed_endog_category=0
. replace ed_endog_category= hed if hed==wed
(4 real changes made)
. table hed wed , contents (mean ed_endog_category)
----------------------------------
| wed
hed | 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 hed wed ed_endog_category
-------------------------------------------------------------------------------
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
hed
1 2 1.134** 0.007
2 3 0.819** 0.006
3 4 -0.017* 0.007
wed
4 2 1.372** 0.007
5 3 1.020** 0.007
6 4 -0.278** 0.008
ed_endog_category
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
. *What this tells us is, first, that the power of educational endogamy is
different depending on how much education you have.
Educational endogamy is highest at the top and the bottom of the educational distribution. Secondly, this model fits a lot better than the previous model, which is another way of
showing that the force of educational endogamy is not uniform across educational groups. The difference between this and the previous model is about 35K on 3df.
. exit, clear