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

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

> ss_13_log.log

  log type:  text

 opened on:   8 Nov 2007, 11:32:49

 

. use "C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2007\ed_interm

> ar.dta", clear

 

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

 

*See my Comprehensive Excel file for explanations of this....

 

 

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

husband's |                 wife's education               

education |      <HS        HS  Some Col       BA+     Total

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

      <HS |    32016     33374      8407       988     74785

       HS |    28370    137876     43783      8446    218475

 Some Col |     7051     48766     61633     18195    135645

      BA+ |      984     13794     28635     51224     94637

          |

    Total |    68421    233810    142458     78853    523542

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

 

. 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      HS                                                   1.072**     0.004

2      Some Col                                             0.595**     0.005

3      BA+                                                  0.235**     0.005

     wed

4      HS                                                   1.229**     0.004

5      Some Col                                             0.733**     0.005

6      BA+                                                  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

 

. *Independence model

. set linesize 79

 

. predict P_indep_again

(option n assumed; predicted number of events)

 

. table hed wed, contents(sum P_indep_again)

 

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

husband's |            wife's education          

education |      <HS        HS  Some Col       BA+

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

      <HS | 9773.551  33398.43  20349.32   11263.7

       HS |  28552.2  97569.33  59447.98   32905.5

 Some Col | 17727.26  60578.06  36909.58   20430.1

      BA+ | 12367.98  42264.19  25751.13   14253.7

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

 

. display (9773.5*97569)/(33398*28552)

1.0000115

 

. display ln((9773.5*97569)/(33398*28552))

.00001146

 

. *Now, let's look at the simlplest one term interaction we used before, which is one term for endogamy

. table hed wed, contents(mean  ed_endogamy_simple)

 

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

husband's |            wife's education          

education |      <HS        HS  Some Col       BA+

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

      <HS |        1         0         0         0

       HS |        0         1         0         0

 Some Col |        0         0         1         0

      BA+ |        0         0         0         1

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

 

. desmat: poisson count hed wed  ed_endogamy_simple

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

   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      HS                                                    0.740**     0.005

2      Some Col                                              0.414**     0.005

3      BA+                                                   0.216**     0.005

     wed

4      HS                                                    0.979**     0.005

5      Some Col                                              0.608**     0.005

6      BA+                                                   0.081**     0.005

     ed_endogamy_simple

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

 

. *We get a strong measure of endogamy, but it doesn't fit so well...

. * Local table odds ratios from the predicted vals of this model would be exp(1.115) squared along the diagonal, and one elsewhere.

. predict P_diag

(option n assumed; predicted number of events)

 

. table hed wed, contents(sum P_diag)

 

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

husband's |            wife's education          

education |      <HS        HS  Some Col       BA+

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

      <HS | 26426.32  23047.51  15915.36  9395.808

       HS | 18145.71  147304.7  33341.21  19683.35

 Some Col | 13104.12  34867.67  73458.66  14214.54

      BA+ | 10744.85  28590.09  19742.76   35559.3

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

 

. display (exp(1.115))^2

9.2998661

 

. display 26426.3*147304.7/(23047.5*18145.7)

9.3079794

 

. *Close enough for government work

. *off the diagonal, our previous model makes no assumptions, so we should have

>  local table odds ratio of 1

. display 15915.4*19683.4/(9395.81*33341.2)

1.0000051

 

. *And there it is.

. *So, the coefficients tell you about odds ratios in the local tables of the p

> redicted values.

. *now let's look at the scores.

. gen score=hed*wed

 

. table hed wed, contents(mean score)

 

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

husband's |            wife's education          

education |      <HS        HS  Some Col       BA+

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

      <HS |        1         2         3         4

       HS |        2         4         6         8

 Some Col |        3         6         9        12

      BA+ |        4         8        12        16

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

 

. desmat: poisson count hed wed @score

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

   Poisson regression

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

   Dependent variable                                                    count

   Optimization:                                                            ml

   Number of observations:                                                  16

   Initial log likelihood:                                         -221501.223

   Log likelihood:                                                   -6373.659

   LR chi square:                                                   430255.129

   Model degrees of freedom:                                                 7

   Pseudo R-squared:                                                     0.971

   Prob:                                                                 0.000

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

nr Effect                                                    Coeff        s.e.

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

   count

     hed

1      HS                                                   -0.836**     0.006

2      Some Col                                             -3.731**     0.012

3      BA+                                                  -7.128**     0.021

     wed

4      HS                                                   -0.671**     0.006

5      Some Col                                             -3.656**     0.012

6      BA+                                                  -7.418**     0.022

7    score                                                   1.000**     0.003

8    _cons                                                   9.270**     0.005

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

*  p < .05

** p < .01

 

. *We get one value for score, which turns out by chance to be 1.000.

. poisgof

 

         Goodness-of-fit chi2  =  12561.32

         Prob > chi2(8)        =    0.0000

 

. *compared to the one term for endogamy, this one term for linear by linear association fits fairly well.

. predict P_scores

(option n assumed; predicted number of events)

 

. table hed wed, contents (sum P_scores)

 

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

husband's |            wife's education          

education |      <HS        HS  Some Col       BA+

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

      <HS | 28854.76  40075.84  5506.446  347.9548

       HS | 33991.05  128324.8     47927  8232.138

 Some Col | 5110.256  52440.83   53237.8  24856.12

      BA+ | 464.9252  12968.53  35786.75  45416.79

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

 

. display exp(1)

2.7182818

 

. display 5506.45*8232.14/(347.955*47927)

2.7181982

 

. *We get constant local table odds ratios.

. *The next obvious question, is whether 1,2,3,4 is the appropriate relative spacing between the categories.

. save "C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2007\ed_interm

> ar.dta", replace

file C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2007\ed_intermar.

> dta saved

 

. save "C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2007\ed_interm

> ar.dta", replace

file C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2007\ed_intermar.

> dta saved

 

. exit, clear