-------------------------------------------------------------------------------------------
log: /Users/baum/doc/Courses 2008-2009/EC228 F2008/ec228_f2008_day1.smcl
log type: smcl
opened on: 28 Aug 2008, 11:32:13
.
. // ec228_f2008_day1 cfb 28aug2008
.
. // display the codebook
. type http://fmwww.bc.edu/ec-p/data/wooldridge/crime1.des
CRIME1.DES
narr86 nfarr86 nparr86 pcnv avgsen tottime ptime86 qemp86
inc86 durat black hispan born60 pcnvsq pt86sq inc86sq
Obs: 2725
1. narr86 # times arrested, 1986
2. nfarr86 # felony arrests, 1986
3. nparr86 # property crme arr., 1986
4. pcnv proportion of prior convictions
5. avgsen avg sentence length, mos.
6. tottime time in prison since 18 (mos.)
7. ptime86 mos. in prison during 1986
8. qemp86 # quarters employed, 1986
9. inc86 legal income, 1986, $100s
10. durat recent unemp duration
11. black =1 if black
12. hispan =1 if Hispanic
13. born60 =1 if born in 1960
14. pcnvsq pcnv^2
15. pt86sq ptime86^2
16. inc86sq inc86^2
.
. // read in the data
. use http://fmwww.bc.edu/ec-p/data/wooldridge/crime1, clear
.
. // describe its contents and calculate descriptive stats
. describe
Contains data from http://fmwww.bc.edu/ec-p/data/wooldridge/crime1.dta
obs: 2,725
vars: 16 10 Jan 2000 16:54
size: 196,200 (99.9% of memory free)
-------------------------------------------------------------------------------------------
storage display value
variable name type format label variable label
-------------------------------------------------------------------------------------------
narr86 float %9.0g
nfarr86 float %9.0g
nparr86 float %9.0g
pcnv float %9.0g
avgsen float %9.0g
tottime float %9.0g
ptime86 float %9.0g
qemp86 float %9.0g
inc86 float %9.0g
durat float %9.0g
black float %9.0g
hispan float %9.0g
born60 float %9.0g
pcnvsq float %9.0g
pt86sq float %9.0g
inc86sq float %9.0g
-------------------------------------------------------------------------------------------
Sorted by:
. summarize
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
narr86 | 2725 .4044037 .8590768 0 12
nfarr86 | 2725 .2333945 .5810142 0 6
nparr86 | 2725 .1255046 .4828473 0 8
pcnv | 2725 .3577872 .395192 0 1
avgsen | 2725 .6322936 3.508031 0 59.2
-------------+--------------------------------------------------------
tottime | 2725 .8387523 4.607019 0 63.4
ptime86 | 2725 .387156 1.950051 0 12
qemp86 | 2725 2.309028 1.610428 0 4
inc86 | 2725 54.96705 66.62721 0 541
durat | 2725 2.251376 4.607063 0 25
-------------+--------------------------------------------------------
black | 2725 .1611009 .3676915 0 1
hispan | 2725 .2176147 .4126997 0 1
born60 | 2725 .3625688 .48083 0 1
pcnvsq | 2725 .284131 .3907343 0 1
pt86sq | 2725 3.951193 22.08584 0 144
-------------+--------------------------------------------------------
inc86sq | 2725 7458.933 16361.24 0 292681
.
. // test H0: average sentence for blacks = avg for non-blacks
. ttest avgsen, by(black)
Two-sample t test with equal variances
------------------------------------------------------------------------------
Group | Obs Mean Std. Err. Std. Dev. [95% Conf. Interval]
---------+--------------------------------------------------------------------
0 | 2286 .4487752 .0587415 2.808555 .333583 .5639673
1 | 439 1.587927 .2794932 5.856033 1.038613 2.137242
---------+--------------------------------------------------------------------
combined | 2725 .6322936 .0672017 3.508031 .5005221 .764065
---------+--------------------------------------------------------------------
diff | -1.139152 .1815257 -1.495094 -.7832099
------------------------------------------------------------------------------
diff = mean(0) - mean(1) t = -6.2754
Ho: diff = 0 degrees of freedom = 2723
Ha: diff < 0 Ha: diff != 0 Ha: diff > 0
Pr(T < t) = 0.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 1.0000
.
. // tabulate number of arrests
. tab narr86
narr86 | Freq. Percent Cum.
------------+-----------------------------------
0 | 1,970 72.29 72.29
1 | 559 20.51 92.81
2 | 121 4.44 97.25
3 | 42 1.54 98.79
4 | 12 0.44 99.23
5 | 13 0.48 99.71
6 | 4 0.15 99.85
7 | 1 0.04 99.89
9 | 1 0.04 99.93
10 | 1 0.04 99.96
12 | 1 0.04 100.00
------------+-----------------------------------
Total | 2,725 100.00
.
. // regression of number of arrests on legal income
. regress narr86 inc86
Source | SS df MS Number of obs = 2725
-------------+------------------------------ F( 1, 2723) = 101.96
Model | 72.5556076 1 72.5556076 Prob > F = 0.0000
Residual | 1937.79155 2723 .711638468 R-squared = 0.0361
-------------+------------------------------ Adj R-squared = 0.0357
Total | 2010.34716 2724 .738012906 Root MSE = .84359
------------------------------------------------------------------------------
narr86 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
inc86 | -.0024495 .0002426 -10.10 0.000 -.0029252 -.0019738
_cons | .5390463 .0209514 25.73 0.000 .4979641 .5801286
------------------------------------------------------------------------------
.
. // consider prior convictions, unemployment, race as well
. regress narr86 inc86 pcnv durat black hispan
Source | SS df MS Number of obs = 2725
-------------+------------------------------ F( 5, 2719) = 36.39
Model | 126.105393 5 25.2210787 Prob > F = 0.0000
Residual | 1884.24176 2719 .692990718 R-squared = 0.0627
-------------+------------------------------ Adj R-squared = 0.0610
Total | 2010.34716 2724 .738012906 Root MSE = .83246
------------------------------------------------------------------------------
narr86 | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
inc86 | -.0021246 .0002572 -8.26 0.000 -.0026289 -.0016203
pcnv | -.1418213 .0404691 -3.50 0.000 -.2211747 -.0624679
durat | .002914 .0036923 0.79 0.430 -.0043259 .010154
black | .3257535 .0452257 7.20 0.000 .2370734 .4144337
hispan | .1804347 .039774 4.54 0.000 .1024443 .258425
_cons | .4736218 .0322772 14.67 0.000 .4103314 .5369122
------------------------------------------------------------------------------
.
. log close
log: /Users/baum/doc/Courses 2008-2009/EC228 F2008/ec228_f2008_day1.smcl
log type: smcl
closed on: 28 Aug 2008, 11:32:14
-------------------------------------------------------------------------------------------