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

       log:  C:\AAA Miker Files\newer web pages\soc_meth_proj3\class9_2009.log

  log type:  text

 opened on:  24 Feb 2009, 11:29:47

 

. set mem 200m

 

Current memory allocation

 

                    current                                 memory usage

    settable          value     description                 (1M = 1024k)

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

    set maxvar         5000     max. variables allowed           1.909M

    set memory          200M    max. data space                200.000M

    set matsize         400     max. RHS vars in models          1.254M

                                                            -----------

                                                               203.163M

 

. use "C:\AAA Miker Files\newer web pages\soc_meth_proj3\cps_mar_2000_new.dta", clear

 

*running through some regressions with dummy variables, interactions and our familiar three occupations

 

. gen new_occ=occ1990

 

r(199);

 

. replace new_occ=. if occ1990~=178 & occ1990~=125& occ1990~=95

(132297 real changes made, 132297 to missing)

 

. tabulate new_occ

 

    new_occ |      Freq.     Percent        Cum.

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

         95 |        966       68.37       68.37

        125 |          6        0.42       68.79

        178 |        441       31.21      100.00

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

      Total |      1,413      100.00

 

*Note the interaction asterisk in between new_occ and sex, below. This asks xi to produce all the possible combinations of interactions between the two variables.

 

. xi: regress incwage i.new_occ*i.sex

i.new_occ         _Inew_occ_95-178    (naturally coded; _Inew_occ_95 omitted)

i.sex             _Isex_1-2           (naturally coded; _Isex_1 omitted)

i.new~c*i.sex     _InewXsex_#_#       (coded as above)

 

      Source |       SS       df       MS              Number of obs =    1413

-------------+------------------------------           F(  5,  1407) =   50.58

       Model |  4.5116e+11     5  9.0232e+10           Prob > F      =  0.0000

    Residual |  2.5101e+12  1407  1.7840e+09           R-squared     =  0.1524

-------------+------------------------------           Adj R-squared =  0.1493

       Total |  2.9612e+12  1412  2.0972e+09           Root MSE      =   42237

 

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

     incwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]

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

_Inew_oc~125 |  -9402.452   30344.26    -0.31   0.757    -68927.32    50122.41

_Inew_oc~178 |   31633.97    5879.32     5.38   0.000     20100.79    43167.15

     _Isex_2 |  -11824.52   5545.056    -2.13   0.033    -22701.99   -947.0565

_InewXse~5_2 |   15287.02   36996.59     0.41   0.680    -57287.39    87861.44

_InewXse~8_2 |  -8707.162   7067.771    -1.23   0.218    -22571.67    5157.342

       _cons |   48602.45   5364.158     9.06   0.000     38079.84    59125.06

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

 

. predict M_class9_interactions

(option xb assumed; fitted values)

(132297 missing values generated)

 

. table  new_occ sex, contents(mean incwage mean  M_class9_interactions)

 

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

          |           Sex          

  new_occ |        Male       Female

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

       95 | 48602.45161   36777.9281

          |    48602.45     36777.93

          |

      125 |       39200      42662.5

          |       39200      42662.5

          |

      178 | 80236.42208  59704.73684

          |    80236.42     59704.74

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

 

. *part of the reason I don't like xi so much is that the resulting table is hard to read. But you can see above that with 6 terms the predicted and actual values coincide on these 6 cells.

 

 

. label define new_occ_lbl 95 "nurses" 125 "soc" 178 "lawyers"

 

. label val new_occ new_occ_lbl

 

. desmat: regress incwage new_occ*sex

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

   Linear regression

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

   Dependent variable                                                    incwage

   Number of observations:                                                  1413

   F statistic:                                                           50.578

   Model degrees of freedom:                                                   5

   Residual degrees of freedom:                                             1407

   R-squared:                                                              0.152

   Adjusted R-squared:                                                     0.149

   Root MSE                                                            42237.424

   Prob:                                                                   0.000

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

nr Effect                                                      Coeff        s.e.

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

   new_occ

1    soc                                                   -9402.452   30344.261

2    lawyers                                               31633.970**  5879.320

   sex

3    Female                                               -11824.524*   5545.056

   new_occ.sex

4    soc.Female                                            15287.024   36996.590

5    lawyers.Female                                        -8707.162    7067.771

6  _cons                                                   48602.452**  5364.158

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

*  p < .05

** p < .01

 

. predict M_class9_interactions_again

(option xb assumed; fitted values)

(132297 missing values generated)

 

* The same as previous, but this time with desmat... And now on to anscombe’s data.

 

. save "C:\AAA Miker Files\newer web pages\soc_meth_proj3\cps_mar_2000_new.dta",

> replace

file C:\AAA Miker Files\newer web pages\soc_meth_proj3\cps_mar_2000_new.dta saved

 

. clear

 

. edit

(8 vars, 11 obs pasted into editor)

- preserve

 

. regress y2 x2

 

      Source |       SS       df       MS              Number of obs =      11

-------------+------------------------------           F(  1,     9) =   17.97

       Model |  27.5000024     1  27.5000024           Prob > F      =  0.0022

    Residual |   13.776294     9  1.53069933           R-squared     =  0.6662

-------------+------------------------------           Adj R-squared =  0.6292

       Total |  41.2762964    10  4.12762964           Root MSE      =  1.2372

 

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

          y2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]

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

          x2 |         .5   .1179638     4.24   0.002     .2331475    .7668526

       _cons |   3.000909   1.125303     2.67   0.026     .4552978     5.54652

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

 

. twoway (scatter y2 x2) (lfit y2 x2)

 

. *This is the stata version of the scatter plot of y2 on x2, with the linear fit(from a simple linear regression) superimposed

 

. exit, clear