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

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

  log type:  text

 opened on:  11 Oct 2007, 11:02:15

 

. use "C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2007\ed_intermar.dta", clear

 

. display chi2tail(3,10)

.01856614

 

. *let's run through, briefly, how to calculate BIC and ID from the models.

. *First thing we need to know is N.

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

 

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

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

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

 

. *Our total N here is 523542.

. *Now let's run a model.

. *let's run model 5.

. desmat: poisson count hed wed  ed_endog_full ed_diff_3

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

   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

     hed

1      HS                                                                            0.942**     0.007

2      Some Col                                                                      0.667**     0.007

3      BA+                                                                           0.009       0.007

     wed

4      HS                                                                            1.132**     0.007

5      Some Col                                                                      0.815**     0.007

6      BA+                                                                          -0.276**     0.008

     ed_endog_full

7      1                                                                             1.410**     0.010

8      2                                                                             0.796**     0.007

9      3                                                                             0.583**     0.007

10     4                                                                             2.147**     0.010

     ed_diff_3

11     1                                                                            -1.947**     0.023

12   _cons                                                                           8.964**     0.008

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

*  p < .05

** p < .01

 

. *let me run it again with smaller line size

. set linesize 75

 

. desmat: poisson count hed wed  ed_endog_full ed_diff_3

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

   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

     hed

1      HS                                                0.942**     0.007

2      Some Col                                          0.667**     0.007

3      BA+                                               0.009       0.007

     wed

4      HS                                                1.132**     0.007

5      Some Col                                          0.815**     0.007

6      BA+                                              -0.276**     0.008

     ed_endog_full

7      1                                                 1.410**     0.010

8      2                                                 0.796**     0.007

9      3                                                 0.583**     0.007

10     4                                                 2.147**     0.010

     ed_diff_3

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 our M5

. predict P_M5

(option n assumed; predicted number of events)

 

. display 35694-4*(ln(523542))

35641.327

 

. *So BIC is easy to calculate after poisgof.

. gen M5_ID= 50*abs(( P_M5/523542)-(count/523542))

 

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

 

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

husband's |                 wife's education               

education |      <HS        HS  Some Col       BA+     Total

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

      <HS |        0  .8714777  .8849629  .0134853  1.769926

       HS | .7943684         0   .147196  .6471726  1.588737

 Some Col | .7808831   .147196         0  .6336873  1.561766

      BA+ | .0134853  1.018674  1.032159         0  2.064318

          |

    Total | 1.588737  2.037347  2.064318  1.294345  6.984747

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

 

. *in order to calculate ID, you need to generate the cell by cell statistic, and then find some way to sum over all cells, I used table to calculate the sum, which in this case is 6.98

. save "C:\AAA Miker Files\newer web pages\soc_388_notes\soc_388_2007\ed_intermar.dta", replace

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

 

. exit, clear