Thinking about Graphs The Grammar of Graphics and Stata.

Slides:



Advertisements
Similar presentations
Graphs, Good and Bad.
Advertisements

SADC Course in Statistics Good graphs & charts using Excel Module B2 Sessions 6 & 7.
® Microsoft Office 2010 Excel Tutorial 4: Enhancing a Workbook with Charts and Graphs.
Copyright © 2013, 2009, and 2007, Pearson Education, Inc. Chapter 2 Exploring Data with Graphs and Numerical Summaries Section 2.2 Graphical Summaries.
Fundamental Features of Graphs All graphs have two, clearly-labeled axes that are drawn at a right angle. –The horizontal axis is the abscissa, or X-axis.
FIRST COURSE Excel Tutorial 4 Working with Charts and Graphics.
SJTU CMGPD 2012 Methodological Lecture Day 2 TABLE, COLLAPSE, HISTOGRAM, TWOWAY BAR.
Graphing With Excel Presented by Frank H. Osborne, Ph. D. © 2008 ID 2950 Technology and the Young Child.
1 Committed to Shaping the Next Generation of IT Experts. Chapter 3 – Graphs and Charts: Delivering a Message Robert Grauer and Maryann Barber Exploring.
COMPREHENSIVE Excel Tutorial 4 Working with Charts and Graphics.
Statistics: Categorical Variables. Do Now:  Give the context/ label the variables for the following situation:  The Federal Aviation Administration.
Data Tutorial Tutorial on Types of Graphs Used for Data Analysis, Along with How to Enter Them in MS Excel Carryn Bellomo University of Nevada, Las Vegas.
SW318 Social Work Statistics Slide 1 Using SPSS for Graphic Presentation  Various Graphics in SPSS  Pie chart  Bar chart  Histogram  Area chart 
CS1100: Computer Science and Its Applications Creating Graphs and Charts in Excel.
1 Good graphs & charts using Excel Module 1 Session 7.
Intro to Graphs Vocab and Categorical Data. Distributions What is a distribution? The distribution of a variable tells us what values the variable takes.
Charts and Graphs V
Variable  An item of data  Examples: –gender –test scores –weight  Value varies from one observation to another.
The introduction to SPSS Ⅱ.Tables and Graphs for one variable ---Descriptive Statistics & Graphs.
Statistical Reasoning for everyday life
Microsoft Office Illustrated Introductory, Premium Edition with Charts Working.
 Frequency Distribution is a statistical technique to explore the underlying patterns of raw data.  Preparing frequency distribution tables, we can.
Graphs An Introduction. What is a graph?  A graph is a visual representation of a relationship between, but not restricted to, two variables.  A graph.
A Picture Is Worth A Thousand Words. DAY 7: EXCEL CHAPTER 4 Tazin Afrin September 10,
VCE Further Maths Chapter Two-Bivariate Data \\Servernas\Year 12\Staff Year 12\LI Further Maths.
1 Excel Lesson 8 Working with Charts Microsoft Office 2010 Introductory Pasewark & Pasewark.
Exploring Data Section 1.1 Analyzing Categorical Data.
1 Graphs Greg C Elvers, Ph.D.. 2 What Are Graphs? Graphs are a non-textual means of presenting information Graphs quickly summarize large sets of data.
Excel chapter 4.
Thinking about Graphics Scales in Stata. Level of measurement Categorical versus continuous Categorical data may be represented as Position along a categorical.
Statistics: Analyzing 2 Categorical Variables MIDDLE SCHOOL LEVEL  Session #1  Presented by: Dr. Del Ferster.
When data is collected from a survey or designed experiment, they must be organized into a manageable form. Data that is not organized is referred to as.
Descriptive Statistics Summarizing data using graphs.
Graphing Tutorial William Hornick CS 101. Overview You will be given a brief description, example, and “how to create” for each of the following: You.
Graphing Graphing used to Display the Data that scientists collected during a controlled experiment.
Bar Graphs Used for comparing separate groups. Axes X- axis: independent variable (what the scientist controls) Horizontal D – dependent R – responding.
A lesson approach © 2011 The McGraw-Hill Companies, Inc. All rights reserved. a lesson approach Microsoft® Excel 2010 © 2011 The McGraw-Hill Companies,
Aim: How do we analyze data with a two-way table?
Creating Graphs in PowerPoint Step 1 Open a new PowerPoint Document.
Graphs and How to Use Them. Graphs Visually display your results and data Allow you (and your peers) to see trends Help to make conclusions easier Are.
Mr. Magdi Morsi Statistician Department of Research and Studies, MOH
1. Tables, Charts, and Graphs Microsoft Word & Excel 2003.
EXCEL GRAPHING *Basic Graphing Steps* by A.B. -NNHS.
1 Excel Lesson 5 Working with Multiple Worksheets and Charts Microsoft Office 2010 Introductory Pasewark & Pasewark.
GRAPHING DATA RECORDING EXPERIMENTAL RESULTS. EXPERIMENTS CONTROL GROUP ALL CONDITIONS STAY THE SAME. RESULTS ARE COMPARED TO EXPERIMENTAL GROUP. EXPERIMENTAL.
Thinking about Graphs The Grammar of Graphics and Stata.
CA II Excel Lessons 8. Lesson 8 Terms √ Chart Types√Chart Properties√Other Terms bar graph Data labels chart column chart Data markers chart sheet line.
Statistics with TI-Nspire™ Technology Module E Lesson 1: Elementary concepts.
Excel Part 4 Working with Charts and Graphics. XP Objectives Create an embedded chart Work with chart titles and legends Create and format a pie chart.
Excel Part 4 Working with Charts and Graphics. XP Objectives Create an embedded chart Work with chart titles and legends Create and format a pie chart.
GRAPHING NOTES Understanding and constructing graphs.
What You Need to Know! Information! Graphs Need.... A Title Labels (words or numbers) Pictures, Bars, or Dots.
Graphing A step by step method. Line Graphs  A line graph is a style of chart that is created by connecting a series of data points together with a line.
By Christy Quattrone Click to View Types of Graphs Data Analysis, Grade 5.
1.1 ANALYZING CATEGORICAL DATA. FREQUENCY TABLE VS. RELATIVE FREQUENCY TABLE.
Excel Lesson 8 Working with Charts
Charts & Graphs CTEC V
Working with Charts © 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part.
Excel Part 4 Working with Charts and Graphics
How to make great graphs that make sense!
Excel Part 4 Working with Charts and Graphics
All About Graphs Graphs and charts are great because they communicate information visually – using a picture!
Microsoft Excel Illustrated
Graphing.
Microsoft Office Illustrated Introductory, Windows XP Edition
Ch 1 G’raph Science.
CMGPD-LN Methodological Lecture Day 3
Excel Lesson 8 Working with Charts
Excel Part 4 Working with Charts and Graphics
Presentation transcript:

Thinking about Graphs The Grammar of Graphics and Stata

Reconstructing two examples From American Sociological Review, August 2005 in Kara Joyner and Grace Kao’s “Interracial Relationships and the Transition to Adulthood ” in Michael J. Rosenfeld and Byung-Soo Kim’s “The Independence of Young Adults and the Rise of Interracial and Same-Sex Unions ”

Examples for reconstruction

Questions toward reconstruction What are the graphical elements? (Geometric objects) How are they related to data? (Variables) How are they arranged on the screen/paper? (Coordinates and guides) How are they decorated? (Style and aesthetics)

Graphical elements/Geometric objects Rectangular boxes, “bars”

Graphical elements/Geometric objects Points and lines/line segments

Stata’s fundamental graphical elements help graph graph twoway     graph matrix graph bar graph dot graph box graph pie help graph twoway scatter line/connected area bar spike/dropline dot contour plus a few more

Relation to data The height of each bar is a summary statistic. The horizontal position of each bar is given by a combination of two categorical variables.

Sufficient data The minimum data we need is three variables – two categorical variables and a summary variable. raceagegroupinter

Simple graph bar use "JoynerKao2005.dta", clear graph bar inter graph bar inter, over(agegroup) graph bar inter, over(agegroup) over(race)

Cleanup – no summary graph bar (asis) inter, over(agegroup) /// over(race) See help graph_bar for a list of summary statistics you could use other than mean and asis

Cleanup – no gap, add legend graph bar (asis) inter, over(agegroup) /// over(race) asyvars “asyvars” is cryptic. To see multiple “y” variables with no grouping, try graph bar inter race agegroup The idea here is that the groups in the first over() are displayed like multiple y variables.

Guides – axes and legends Axes and legends help us keep track of the meaning of different graphical elements, so they also are connected to our data Variable labels Value labels See also help graph_bar##axis_options help graph_bar##legending_options

Variable labels label variable inter "Interracial (%)" label variable race "Race of Respondents" label variable agegroup "Age Group" graph bar (asis) inter, over(agegroup) /// over(race) asyvars

Value labels label define racelbl 1 "Whites" 2 "Blacks" /// 3 "Hispanics" label values race racelbl label define agelbl 1 "22-25 Age Group" 2 /// "26-29 Age Group" 3 "30-35 Age Group" label values agegroup agelbl graph bar (asis) inter, over(agegroup) /// over(race) asyvars

Bar labels graph bar (asis) inter, over(agegroup) /// over(race) asyvars blabel(bar)

Annotation and Aesthetics Titles, captions, and footnotes Color, weight, etc. of graphical elements Grid or guidelines Etc. – there tend to be a large number of options at this point These attributes all have default values. A collection of default values is a “scheme” in Stata (or “style”).

Black and white scheme graph bar (asis) inter, over(agegroup) /// over(race) asyvars blabel(bar) /// scheme(s1mono)

Individual bar colors graph bar (asis) inter, over(agegroup) /// over(race) asyvars blabel(bar) /// scheme(s1mono) bar(1, /// fcolor(gs16)) bar(2, /// fcolor(gs12)) bar(3, fcolor(black))

Titles, captions, notes graph bar (asis) inter, over(agegroup) over(race) asyvars /// blabel(bar) scheme(s1mono) bar(1, fcolor(gs16)) /// bar(2, fcolor(gs12)) bar(3, fcolor(black)) /// caption("Figure 2. Young Adult Relationships that Are Interracial", ring(5)) /// note("NHSLS = National Health and Social Life Survey", ring(6)))

Beginning from individual data We have been graphing a summary statistic The issue is whether or not our graph command can summarize as we want

Set up the data use "nhsls.dta", clear keep if sample == 2 gen wgt=hhsize*(3159/6008) keep if age <=35 keep if ethnic <= 4 forvalues i=1/4 { generate prace`i' = sprace`i' if sp2ply`i' < 3 } keep caseid age prace1-prace4 race ethnic wgt recode prace* (7/9 =.) recode age (18/21=1) (22/25=2)(26/29=3)(30/35=4), generate(agegroup) reshape long prace, i(caseid) j(partner) keep if prace~=. generate inter = ethnic ~= prace

A second look at graph bar graph bar inter // mean graph bar (percent) inter * not what you expect! graph bar (percent), over(inter) tab inter

Add another categorical variable graph bar (percent), over(inter) over(agegroup) /// blabel(bar) tab inter agegroup, col cell

Problems Percents are percent of total rather than percent of category Bars for the unwanted category Solutions Work in fractions rather than percents Create a summary data set

As fractions graph bar inter, over(agegroup) over(race) /// blabel(bar)

With our other options applied Variable labels Value labels Scheme Bar color Axis label angle Caption Note One new option is the “ytitle”