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

      name:  <unnamed>

       log:  C:\Users\mexmi\Documents\newer web pages\soc_meth_proj3\Soc180B_spr2019_logs\class5_l

> og.log

  log type:  text

 opened on:  16 Apr 2019, 14:45:04

 

. use "C:\Users\mexmi\Desktop\cps_mar_2000_new.dta", clear

 

. *class starts here

 

. tabulate occ1990 if occ1990==178| occ1990==95 | occ1990==125

 

                 Occupation, 1990 basis |      Freq.     Percent        Cum.

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

                      Registered nurses |        966       68.37       68.37

                  Sociology instructors |          6        0.42       68.79

                                Lawyers |        441       31.21      100.00

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

                                  Total |      1,413      100.00

 

. tabulate occ1990 if occ1990==178| occ1990==95 | occ1990==125, nolab

 

Occupation, |

 1990 basis |      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

 

* a reminder of which code stands for which occupation.

 

. table occ1990 if occ1990==178| occ1990==95 | occ1990==125, contents (freq mean incwage sd incwage)

 

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

Occupation, 1990      |

basis                 |         Freq.  mean(incwage)    sd(incwage)

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

    Registered nurses |           966    37536.85197       21839.96

Sociology instructors |             6    41508.33333       6963.219

              Lawyers |           441    74044.32653       69032.96

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

 

* In order to get Excel to generate the t-tests, all you need are mean, sd, and n (i.e. unweighted frequency).

 

. graph box incwage if occ1990==178| occ1990==95 | occ1990==125, over (occ1990)

 

. graph hbox incwage if occ1990==178| occ1990==95 | occ1990==125, over (occ1990)

 

 

* Two versions of the box plot of incwage across our 3 occupations.

 

. table occ1990 if occ1990==178| occ1990==95 | occ1990==125, contents(freq p25 incwage p50 incwage p75 incwage)

 

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

Occupation, 1990      |

basis                 |        Freq.  p25(incwage)  med(incwage)  p75(incwage)

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

    Registered nurses |          966         25000         37000         48000

Sociology instructors |            6         35000         41200         46000

              Lawyers |          441         17000         61000        100960

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

 

* The top and bottom of the boxplot are 25th percentile and 75th percentile, and the middle is the median or 50th percentile, whose values you can get directly from the table command above.

 

 

. summarize incwage if occ1990==178, detail

 

                   Wage and salary income

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

      Percentiles      Smallest

 1%            0              0

 5%            0              0

10%            0              0       Obs                 441

25%        17000              0       Sum of Wgt.         441

 

50%        61000                      Mean           74044.33

                        Largest       Std. Dev.      69032.96

75%       100960         279376

90%       197387         279376       Variance       4.77e+09

95%       229339         279376       Skewness       1.132374

99%       257525         364302       Kurtosis       3.973892

 

* You can also use summarize, detail to give you the percentile distributions of each of the 3 occupations (lawyers above).

 

 

 

* The syntax for a ttest comparing incwage of nurses and sociologists:

. ttest incwage if occ1990==95|occ1990==125, by(occ1990)

 

Two-sample t test with equal variances

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

   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]

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

Register |     966    37536.85    702.6892    21839.96    36157.88    38915.83

Sociolog |       6    41508.33    2842.722    6963.219    34200.88    48815.78

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

combined |     972    37561.37    698.6046    21780.33    36190.42    38932.32

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

    diff |           -3971.481    8923.041               -21482.17    13539.21

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

    diff = mean(Register) - mean(Sociolog)                        t =  -0.4451

Ho: diff = 0                                     degrees of freedom =      970

 

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0

 Pr(T < t) = 0.3282         Pr(|T| > |t|) = 0.6564          Pr(T > t) = 0.6718

 

 

* The same comparison, but with the unequal variance t-test.

. ttest incwage if occ1990==95|occ1990==125, by(occ1990)unequal

 

Two-sample t test with unequal variances

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

   Group |     Obs        Mean    Std. Err.   Std. Dev.   [95% Conf. Interval]

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

Register |     966    37536.85    702.6892    21839.96    36157.88    38915.83

Sociolog |       6    41508.33    2842.722    6963.219    34200.88    48815.78

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

combined |     972    37561.37    698.6046    21780.33    36190.42    38932.32

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

    diff |           -3971.481    2928.283               -11252.58     3309.62

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

    diff = mean(Register) - mean(Sociolog)                        t =  -1.3562

Ho: diff = 0                     Satterthwaite's degrees of freedom =  5.62958

 

    Ha: diff < 0                 Ha: diff != 0                 Ha: diff > 0

 Pr(T < t) = 0.1134         Pr(|T| > |t|) = 0.2269          Pr(T > t) = 0.8866

 

. log close

      name:  <unnamed>

       log:  C:\Users\mexmi\Documents\newer web pages\soc_meth_proj3\Soc180B_spr2019_logs\class5_l

> og.log

  log type:  text

 closed on:  16 Apr 2019, 16:23:55

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