DOC PREVIEW
MIT 17 871 - STATA commands

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

17.871Spring 2006STATA demonstration handoutFebruary 16, 2006Files, etc. we will return toI. Athena locker with data: /mit/17.871/ExamplesA. To access the first time: (at the Athena prompt)attach 17.871cd /mit/17.871/ExamplesB. To access after you’ve typed the “attach” command:cd /mit/17.871/ExamplesII. Within the Athena locker with the examples are the following files that are used in lecture:File Descriptionblack_officials.dat Raw data file. The data are ordered as follows: statename, % black elected officials, % population African-American, dummy variable for southern state. Thedata are “free form”black_officials.do STATA “do” file that records the commands necessaryto set up black_officials.dat for analysisblack_officials.dta STATA “data” file that saves data in binary form foreasy re-useblack_officials_no_space.dat Raw data file. The data are ordered the same as inblack_officials.dat, except they are in “fixed format”. The numbers in parentheses indicate how manycolumns each variable takes up: state name (2), %black elected officials (4), % population African-American (4), dummy variable for southern state (1)III. STATA commands I will be typing1 log using black_officials, text2 infile str2 state beo bpop south using/mit/17.871/Examples/black_officials.dat3 list4 mvdecode beo bpop, mv(-9); list5 histogram beo; histogram bpop; histogram bpop, bin(20)5.1 graph7 beo; graph7 bpop; graph7 bpop, bin(20)6 graph box beo bpop6.1 graph7 beo bpop, box7 scatter beo bpop7.1 graph7 beo bpop8 twoway (scatter beo bpop), yscale(range(0 40.))xscale(range(0 40.)) ysize(5) xsize(5)8.1 graph7 beo bpop, xscale(0,40) yscale(0,40)9 twoway (scatter beo bpop, mcolor(none) mlabel(state)mlabposition(0))9.1 graph7 beo bpop, s([state])10 twoway (scatter beo bpop) (line bpop bpop, sort)10.1 graph7 bpop beo bpop, c(l.) s(iO) sort11 twoway (scatter beo bpop, mcolor(none) mlabel(south)) (linebpop bpop, sort)11.1 graph7 bpop beo bpop, c(l.) s(i[south]) sort12 sort south; graph box beo bpop, over(south)12.1 sort south; graph7 beo, box by(south)13 gen diff=beo-bpop14 gen diff_pct=diff/bpop15 graph box diff, over(south)15.1 graph7 diff, box by(south)16 graph box diff_pct, over(south)16.1 graph diff_pct, box by(south)17 ttest diff, by(south)18 ttest diff_pct, by(south)19 twoway (scatter beo bpop) (lfit beo bpop)19.1 reg beo bpop; predict py; graph beo py bpop, s(Oi) c(.l)sort20 save /mit/17.801/Examples/black_officials21 use /mit/17.801/Examples/runoffs; list; list; clear22 use /mit/17.801/Examples/black_officials23 sort state24 merge state using runoffs25 use /mit/17.871/Examples/idaho_examplecollapse (sum) sen_rep


View Full Document

MIT 17 871 - STATA commands

Documents in this Course
Load more
Download STATA commands
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view STATA commands and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view STATA commands 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?