statawalk2 - Stata Walkthrough: Graphics. For this...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Stata Walkthrough: Graphics. For this walkthrough, you will need to download the database on US workers in the March 2005 CPS and the one on cod catches. Start with the CPS ( If you have an error loading the database, try typing the command set mem 100m to increase the memory used by Stata. ) Highest educational attainment is a categorical variable, described in six levels: less than high school, some high school, high school, technical or associate’s degree or some college, college degree, and professional or graduate degree. These are captured in the variable educ ( which takes values 1 through 6 ) or equivalently in the dummy variables educ1 through educ6 . The simplest way to illustrate these graphically is through a bar graph or pie graph. The command for the first of these is graph bar educ1-educ6 ( the dash indicates variables educ1 through educ6 , as they are listed in the variable window. ) Try both of these commands. One thing you will notice is that the bar graph returns decimal values. It is telling you the fraction of the sample in each category. This is because the default option for a bar graph is to report the mean of the variable ( and the mean of a dummy variable is the fraction in that group ) . If you want to know the total number in each category, try graph bar (sum) educ1-educ6 You can also specify other descriptive statistics in parentheses after the word bar; check the help files. To construct a pie chart, type graph pie educ1-educ6 This produces a colorful, uninformative pie chart. You can add in additional information:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
graph pie educ1-educ6, plabel(_all percent) will superimpose the fraction in each category; graph pie educ1-educ6, plabel(_all sum) will tell you the absolute numbers in each group. ( Read the help files for other information that you can superimpose. ) Finally, rather than creating a bunch of dummy variables educ1 through educ6 , you can also the categorical variable educ to produce a pie chart. In this case, you type: graph pie, over(educ) The output is the same, and you can superimpose information in the same way. However, you know that I don’t particularly care for pie charts, since I find that they rarely invite comparisons , which is one principle for good graphics. We can create a bunch of side - by - side pie charts using the command: graph pie educ1-educ6 if race<5, by(race) The option by signals “side - by - side”. Also, note that I’ve added a qualifier to this statement, to include people with race less than 5. In the CPS, the race codes are 1 for Caucasian, 2 for African, 3 for Native American, and 4 for Asian; codes of 5 and above are for smaller minorities
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/19/2010 for the course ECON 400 taught by Professor Turchi during the Spring '08 term at UNC.

Page1 / 7

statawalk2 - Stata Walkthrough: Graphics. For this...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online