80
SEEING IS BELIEVING: Telling stories with statistics – in pictures

SEEING IS BELIEVING: Telling stories with statistics – in pictures

  • Upload
    yovela

  • View
    50

  • Download
    0

Embed Size (px)

DESCRIPTION

SEEING IS BELIEVING: Telling stories with statistics – in pictures. We’re failing. Do you see the same thing here?. This is your brain on statistics. The total sample is (roughly) evenly divided by gender. - PowerPoint PPT Presentation

Citation preview

Page 1: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

SEEING IS BELIEVING: Telling stories with statistics – in pictures

Page 2: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

We’re failing

Page 3: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Do you see the same thing here?

Gender Male Female

Military -------------- ---------

No 943 1,222

Yes 227 72

Page 4: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

This is your brain on statistics

Gender Male Female

Military -------------- ---------

No 943 1,222

Yes 227 72

Page 5: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

The total sample is (roughly) evenly divided by gender.Subtracting 72 from the 150 one would expect gives a

value of about 80, which squared is 6,400.It is already obvious this is significant.

Page 6: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Just for closure ..

e o (e-o) ^2 ((e-o)^2)/e157 72 7225 46.01910828142 227 7225 50.88028169

1028 943 7225 7.0282101171137 1222 7225 6.354441513

110.2820416

Page 7: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Seeing is a learned skill

Statisticians may see things in a picture others don’t

Page 8: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

My points

(surprisingly, I do have some)

Page 9: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Data Visualization

Graphics do not necessarily stand alone

Page 10: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Data visualization is all around us.

Page 11: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Visual representation in one context is often misapplied to another.

Page 12: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Atomic numbers on your socks?

Page 13: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Data visualization needs to ADD information

Page 14: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Basic Assumptions

• Our audience needs to be taught to read visual data just as we read numeric data, and we need to learn to have some discussion beyond the choices of line graphs vs. pie charts

Page 15: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

YOU NEED TO LEARN TO WRITE PICTURES

You learned to read numbers

Or, to be more specific, you need to explain to others what you see in pictures

Page 16: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

?

Question + Data > Picture = Story

Page 17: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Bad visualization for one question can be good for another

• Who will win the election?

• Which regions support the Democrats?

Poll dataset did not include Hawaii or Alaska

Page 18: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

DATA VISUALIZATION BY EXAMPLE

AN EXAMPLE OF PROGRAM EVALUATION

Page 19: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

The government is smarter than you think

(No, I’m serious)

Page 20: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Was the program implemented as planned?

Page 21: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Was the program implemented as planned?

Page 22: SEEING IS BELIEVING:  Telling stories with statistics – in pictures
Page 23: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

(This was done in JMP)

Page 24: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Did the program work?

Page 25: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

GOPTIONS HBY = 2 ;PROC GPLOT

DATA=wussexample UNIFORM; PLOT z_total_post * z_total_pre / VREF=0 ;BY group;

Page 26: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

EQUATIONS IN THE SAS LOG FOR THE STATISTICIAN IN YOU

NOTE: Regression equation : z_total_post = 0.13379 + 0.776552*z_total_pre.NOTE: The above message was for the following BY group: group=CONTROLNOTE: Regression equation : z_total_post = 1.233616 + 0.578418*z_total_pre.NOTE: The above message was for the following BY group: group=EXPERIMENTAL

Page 27: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Is the intervention successful under all conditions?

Page 28: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

TRAINING WAS ADMINISTERED TO FOUR COHORTS

Admittedly, we did not train people while flying on a trapeze

Page 29: SEEING IS BELIEVING:  Telling stories with statistics – in pictures
Page 30: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Creating the interaction graph

First, in the RESULTS window, type

sgedit on

Page 31: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Creating the interaction graphFirst, in the RESULTS window, type

sgedit on

Ods listing sge = on ;Ods graphics on ;proc glm data = plots ; class TestType cohort ;

model z_total = TestType cohort TestType*cohort ;where group = "EXPERIMENTAL" ;

Page 32: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Click on the sge plot to edit it

Page 33: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

ODDLY, THE MOST TIME-CONSUMING PART OF THIS IS MAKING THE LINES THICKER

Of course, that is kind of like being the smaller midget

Page 34: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Using SGEDIT to, well, edit

1. Double-click on the .sge file in the RESULTS window

2. Right-click in the plot area & select PLOT PROPERTIES

3. Select desired line thickness

Page 35: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

THANKS FOR ASKING!

Yes, the TestType*Cohort*Group interaction (F=5.84, p < .0001) AND the TestType*Group interaction (F=22.92, p < 0001) in the other repeated measures ANOVA were significant.

Page 36: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

LOOKING AT THE LITTLE PICTURE

Page 37: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

(Especially true for small samples)

Graphs sometimes providebetter information than

numbers

Page 38: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

or…

How SAS ODS GRAPHICS

can improve your life

Page 39: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Are these test related?

R=.22

Page 40: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Look!

Page 41: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Another example

• Years of Education as predictor of gain score

• R-square = .46 • Correlation = .68)• P <.01.

Page 42: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Now looky here …

Is it a real relationship?

Page 43: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

What should we do?

Throw the score out?Keep the score in?Something else?

Page 44: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Ignoring my partner …

Compare your answers with the people next to you

Page 45: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Sometimes outliers are the most interesting part of your study

Page 46: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

ODS GRAPHICS ON;

<some procedure>

ODS GRAPHICS OFF;

Page 47: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

PROC CORR

Page 48: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

One last example on knowing your data

Not just telling a story, having a conversation

Page 49: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

PROC FREQ

Page 50: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Custom Map-making

How to plot the largest category in a frequency distribution

Page 51: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

1, 2, 3

1. PROC TABULATE -> output dataset2. PROC FORMAT3. Proc GMAP

Page 52: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

DATA VISUALIZATION BY EXAMPLE

WHERE IS DEMOCRATIC SUPPORT BASED? DATA VISUALIZATION IN POLITICAL SURVEYS

Page 53: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

PROC TABULATE

DATA= in.VOTE2008 OUT=SummaryVOTE2008 ;

CLASS question3 state ;TABLE state, question3* RowPctN ;

Page 54: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

WARNING: Some observations were discarded when charting PctN_01. Only first matching observation was used. Use STATISTIC= option for summary statistics.

Page 55: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

proc format ;

value vote 50.01 - 100 = "Obama" 0 - 50 = "McCain" ;

Page 56: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

PROC GMAP

DATA = SummaryVOTE2008 map = maps.us ;ID state ;

CHORO PctN_01 / discrete LEGEND=LEGEND1 ;

Page 57: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

ID statement uses the _map_geometry_ variable that was merged in from the maps.us dataset to identify the location on the map.

Page 58: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

PROC GMAP

DATA = SummaryVOTE2008 map = maps.us ;ID state ;

CHORO PctN_01 / discrete LEGEND=LEGEND1 ;Pattern1 c = red ;Pattern2 c = blue ;format PctN_01 vote. ;

Page 59: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

PROC GMAP

CHORO PctN_01 / discrete LEGEND=LEGEND1 ;FORMAT PctN_01 vote. ;

CHORO statement uses the first observation and ignores the others.

Page 60: SEEING IS BELIEVING:  Telling stories with statistics – in pictures
Page 61: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Does Race Matter?

Page 62: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

PROC GMAP

Vote2008 coded 0 = McCain1 =

Obama

Pctmin = Percentage of residents in voter’s district from minority groups

Page 63: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

PROC GMAP

DATA = wuss map=maps.us ;ID state ;

area vote2008 / discrete statistic = mean ;block pctmin / discrete statistic = mean ;format pctmin rangep. vote2008 voten. ;

Page 64: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

The BLOCK statement charts the pctmin variable. The height of the block will be based on the value of the variable, but the color will be determined using the format specified.

Page 65: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

mean minority percentage in districts where Obama voters live is 21% versus 13% for McCain voters

(t= 5.73, p < .0001)

Page 66: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

The usefulness of visual data

With one statement, I can change the percentage of minority & re-run the chart

value rangep 0 - 15 = "0 -15%" 15.01 - 100 = "> 15%

%" ;

Page 67: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

DATA VISUALIZATION BY EXAMPLE

Decision Trees, ROC & Lift Curves to Predict Military Service

Page 68: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Speaking of easy, interactive, graphics

JMP

Page 69: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

libname readin "E:\crimes\readout" ;

libname writeout xport "e\wuss2010\crimes.xpt" ;

proc copy in = readin out =writeout ;

Page 70: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

How to get a SAS .xpt file into JMP, Step 1

File > Open

Page 71: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

DECISION TREE

• ANALYZE > MODELING > PARTITION• SELECT Y• SELECT X VARIABLES• Click on the SPLIT button

Page 72: SEEING IS BELIEVING:  Telling stories with statistics – in pictures
Page 73: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Receiver Operating Characteristic

Click on the red arrow at the top left of the partition window for pull-down options include ROC and Lift curves.

Page 74: SEEING IS BELIEVING:  Telling stories with statistics – in pictures
Page 75: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

ROC

• Sensitivity is the percent of true positives, for example, the percentage of people you predicted would die who actually died.

• Specificity is the percent of true negatives, for example, the percentage of people you predicted would NOT die who survived.

Page 76: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

Comparing models

Page 77: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

In JMP, use of training and testing datasets is REALLY easy

EXCLUDE 25% or 50% of the data and then re-run your analyses with the

excluded sample

Page 78: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

A statistician is a person who was good at math but didn’t have enough personality to be an accountant ?

Page 79: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

It is important that people believe you

And that’s my story

Page 80: SEEING IS BELIEVING:  Telling stories with statistics – in pictures

AnnMaria De Mars

The Julia Group2111 7th St #8

Santa Monica, CA [email protected]

(310) 717 -9089