## STATA Assignment Solution on Income Difference between Men and Women

• 23rd Dec, 2021
• 00:47 AM
```{smcl}
{com}{sf}{ul off}{txt}{.-}
name:  {res}
{txt}log:  {res}E:\Ishan\Self\IDR\2020\May 2020\STATA_Elena_6th May\Log.smcl
{txt}log type:  {res}smcl
{txt}opened on:  {res} 9 May 2020, 10:02:53

{com}. use "E:\Ishan\Self\IDR\2020\May 2020\STATA_Elena_6th May\final_project.dta"

.
. ttest income, by(female)

{txt}Two-sample t test with equal variances
{hline 9}{c TT}{hline 68}
Group{col 10}{c |}{col 16}Obs{col 27}Mean{col 35}Std. Err.{col 47}Std. Dev.{col 59}[95% Conf. Interval]
{hline 9}{c +}{hline 68}
0 {c |}{res}{col 12}    146{col 22} 48186.67{col 34} 3563.358{col 46} 43056.22{col 58} 41143.84{col 70}  55229.5
{txt}1 {c |}{res}{col 12}    153{col 22} 41887.58{col 34} 3071.582{col 46} 37993.37{col 58} 35819.08{col 70} 47956.09
{txt}{hline 9}{c +}{hline 68}
combined {c |}{res}{col 12}    299{col 22} 44963.39{col 34} 2347.889{col 46}  40598.8{col 58} 40342.85{col 70} 49583.94
{txt}{hline 9}{c +}{hline 68}
diff {c |}{res}{col 22}  6299.09{col 34} 4690.748{col 58}-2932.225{col 70}  15530.4
{txt}{hline 9}{c BT}{hline 68}
diff = mean({res}0{txt}) - mean({res}1{txt})                                      t = {res}  1.3429
{txt}Ho: diff = 0                                     degrees of freedom = {res}     297

{txt}Ha: diff < 0 xss=removed> 0
Pr(T < t> |t|) = {res}0.1803          {txt}Pr(T > t) = {res}0.0902

{com}.
. twoway (scatter income age)
{res}
{com}.
. correlate age income
{txt}(obs=299)

{c |}      age   income
{hline 13}{c +}{hline 18}
age {c |}{res}   1.0000
{txt}income {c |}{res}   0.2959   1.0000

{com}.
. twoway (scatter income educ)
{res}
{com}.
. correlate educ income
{txt}(obs=299)

{c |}     educ   income
{hline 13}{c +}{hline 18}
educ {c |}{res}   1.0000
{txt}income {c |}{res}   0.3515   1.0000

{com}.
. oneway income race, tabulate

{txt}Self-Report {c |}    Summary of Individual Income
ed Race {c |}        Mean   Std. Dev.       Freq.
{hline 12}{c +}{hline 36}
Black/Afr {c |}  {res}  41082.11    39938.21          73
{txt}Asian onl {c |}  {res} 50613.846   38820.983          39
{txt}White onl {c |}  {res} 50989.134   45665.148         127
{txt}    Other {c |}  {res} 33258.333   26407.538          60
{txt}{hline 12}{c +}{hline 36}
Total {c |}  {res} 44963.391   40598.803         299

{txt}Analysis of Variance
Source              SS         df      MS            F     Prob > F
{hline 72}
Between groups     {res} 1.5177e+10      3   5.0589e+09      3.14     0.0259
{txt} Within groups     {res} 4.7601e+11    295   1.6136e+09
{txt}{hline 72}
Total          {res} 4.9118e+11    298   1.6483e+09

{txt}Bartlett's test for equal variances:  chi2({res}3{txt}) = {res} 20.4673{txt}  Prob>chi2 = {res}0.000

{com}.
. regress income age us_citizen educ female

{txt}      Source {c |}       SS           df       MS      Number of obs   ={res}       299
{txt}{hline 13}{c +}{hline 34}   F(4, 294)       = {res}    19.31
{txt}       Model {c |} {res} 1.0220e+11         4  2.5550e+10   {txt}Prob > F        ={res}    0.0000
{txt}    Residual {c |} {res} 3.8898e+11       294  1.3231e+09   {txt}R-squared       ={res}    0.2081
{txt}{hline 13}{c +}{hline 34}   Adj R-squared   ={res}    0.1973
{txt}       Total {c |} {res} 4.9118e+11       298  1.6483e+09   {txt}Root MSE        =   {res}  36374

{txt}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}      income{col 14}{c |}      Coef.{col 26}   Std. Err.{col 38}      t{col 46}   P>|t|{col 54}     [95% Con{col 67}f. Interval]
{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 9}age {c |}{col 14}{res}{space 2} 729.6541{col 26}{space 2} 144.8617{col 37}{space 1}    5.04{col 46}{space 3}0.000{col 54}{space 4} 444.5567{col 67}{space 3} 1014.752
{txt}{space 2}us_citizen {c |}{col 14}{res}{space 2} 2611.659{col 26}{space 2} 7766.294{col 37}{space 1}    0.34{col 46}{space 3}0.737{col 54}{space 4}-12672.92{col 67}{space 3} 17896.24
{txt}{space 8}educ {c |}{col 14}{res}{space 2} 4332.421{col 26}{space 2} 666.9918{col 37}{space 1}    6.50{col 46}{space 3}0.000{col 54}{space 4} 3019.738{col 67}{space 3} 5645.105
{txt}{space 6}female {c |}{col 14}{res}{space 2} -9129.22{col 26}{space 2} 4272.853{col 37}{space 1}   -2.14{col 46}{space 3}0.033{col 54}{space 4}-17538.48{col 67}{space 3}-719.9651
{txt}{space 7}_cons {c |}{col 14}{res}{space 2}-64559.33{col 26}{space 2}  14462.8{col 37}{space 1}   -4.46{col 46}{space 3}0.000{col 54}{space 4}-93023.08{col 67}{space 3}-36095.59
{txt}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}
{com}. exit, clear
```