+ All Categories
Home > Documents > Creating Proportional Venn Diagrams Using Google and SAS ® Hillary Kruger, RTI International, USA.

Creating Proportional Venn Diagrams Using Google and SAS ® Hillary Kruger, RTI International, USA.

Date post: 14-Dec-2015
Category:
Upload: isiah-spillers
View: 235 times
Download: 2 times
Share this document with a friend
Popular Tags:
16
Creating Proportional Venn Diagrams Using Google and SAS ® Hillary Kruger, RTI International, USA
Transcript

Creating Proportional Venn Diagrams Using Google and SAS®

Hillary Kruger, RTI International, USA

(1) What are Venn diagrams?

(2) Why use them?

(3) What are good and bad examples?

(4) How are they made in SAS® with Google?

(5) Resources and References

Proportional Venn Diagrams

What is a Venn Diagram?

Why Choose a Venn Diagram?

+ Venn diagrams are an effective and efficient way to show overlapping data

+ Easy to understand for a variety of audiences

+ Universally useful across disciplines

+ Recent resurgence in popularity

Venn Diagrams

Some Venn diagrams are not mathematically accurate, but are still useful - or at least entertaining

Venn Diagrams

To accurately reflect data sets, one must create diagrams that show the true overlap in data

Venn Diagrams in SAS®

SAS® offers Venn options (like below) but they are not proportional

Proportional Venn Diagrams in SAS®

Others have addressed this previously, using tedious code, and produced the following results:

ALGORITHMWe here present an algorithm to create an area-proportional Venn diagram of 3 sets: A1, A2 andA3. First, assume |A1|= a1, |A2|= a2, |A3|= a3, |A1A2|= a12, |A1A3|= a13, |A2A3|=a23 and|A1A2A3|=a123. Without loss the generality, we further assume A1, A2 and A3 are subsets of apopulation P, and with 0<=ai, aij, aijk<1 (where1<=i<j<k<=3). Based on these assumptions, wepropose the following SAS algorithm to draw a proportional Venn diagram:a) Calculate the radius of the circle for each set: ri=sqrt[ai/(2π)], where |Ai|=ai.b) Draw the first circle A1 with center (0, 0) and radius r1.

c) Compute the distance d12 for A1 and A2, given r1, r2 and a12=|A1A2|.d) Draw the second circle A2 with center (d12, 0) and radius r2.

e) Estimate the distance d13 for A1 and A3, and distance d23 for A2 and A3.

f) Find the center (x3, y3) of the third circle A3. With some basic geometry knowledge, it iseasily to obtain that the center of the third circle A3 can be expressed in the algebraicfomula as x3=( d12

2+ d13

2- d23

2)/(2d12) and y3=sqrt(d13

2-x3

2).g) Draw the third circle A3 with center (x3, y3) and radius r3.h) Add the legend and others as required to the diagram.

Proportional Venn Diagrams

RECAP: current options

BETTER:

Not visually interesting

FAIR:

Interesting; not mathematical

GOOD:

Not visually accurate

BEST:

Visually interesting and mathematically

accurate; simple implementation

Proportional Venn Diagrams

New Option: Google and SAS®

Pros and Cons

SAS® Only

PROS: Mathematically accurate

CONS: Visually uninteresting; tedious code

SAS® and Google

Pros: Mathematically accurate; plethora of visualization options; simple application

Cons: ??

A Simple Venn Diagram Using GoogleHere are the basic components for Google chart calls:

http://chart.googleapis.com/chart?

cht=<chart_type> &

chd=<chart_data> &

chs=<chart_size> &...additional_parameters...

http://chart.apis.google.com/chart? cht = v & chd= t : 50,60,0,20,0,0,0 & chs= 300x225 & chco= FF6342,ADDE63 &

Venn Diagrams Using Google and SAS®

http://chart.googleapis.com/chart?

cht=<chart_type> &

chd=<chart_data> &

chs=<chart_size> &...additional_parameters...

%let type = v; ** CHART TYPE v=venn; %let col1 = FF6342; ** A COLOR; %let col2 = ADDE63; ** B COLOR; %let col3 = 63C6DE; ** C COLOR; %let dat1 = 35; ** SIZE OF A; %let dat2 = 30; ** SIZE OF B; %let dat3 = 15; ** SIZE OF C; %let dat4 = 8; ** A+B OVERLAP; %let dat5 = 5; ** A+C OVERLAP; %let dat6 = 3; ** B+C OVERLAP;%let dat7 = 4; ** A+B+C OVERLAP;

%let lab1 = Circle+A; ** LABEL A; %let lab2 = Circle+B; ** LABEL B; %let lab3 = Circle+C; ** LABEL C; %let widt = 300; ** WIDTH IN DPI; %let heig = 300; ** HEIGHT IN DPI; %let size = &widt.x&heig.; ** WIDTHxHEIGHT; %let lege = t; ** LEGEND t=top; %let titl = Venn+Diagram; ** TITLE; %let mar1 = 5; ** MARGIN LEFT; %let mar2 = 5; ** MARGIN RIGHT; %let mar3 = 5; ** MARGIN TOP; %let mar4 = 5; ** MARGIN BOTTOM;

Venn Diagrams Using Google and SAS® %let type = v; ** CHART TYPE v=venn; %let col1 = FF6342; ** A COLOR; %let col2 = ADDE63; ** B COLOR; %let col3 = 63C6DE; ** C COLOR; %let dat1 = 35; ** SIZE OF A; %let dat2 = 30; ** SIZE OF B; %let dat3 = 15; ** SIZE OF C; %let dat4 = 8; ** A+B OVERLAP; %let dat5 = 5; ** A+C OVERLAP; %let dat6 = 3; ** B+C OVERLAP;%let dat7 = 4; ** A+B+C OVERLAP; %let lab1 = Circle+A; ** LABEL A; %let lab2 = Circle+B; ** LABEL B; %let lab3 = Circle+C; ** LABEL C; %let widt = 300; ** WIDTH IN DPI; %let heig = 300; ** HEIGHT IN DPI; %let size = &widt.x&heig.; ** WIDTHxHEIGHT; %let lege = t; ** LEGEND t=top; %let titl = Venn+Diagram; ** TITLE; %let mar1 = 5; ** MARGIN LEFT; %let mar2 = 5; ** MARGIN RIGHT; %let mar3 = 5; ** MARGIN TOP; %let mar4 = 5; ** MARGIN BOTTOM;

References Azimaee , Mahmoud. KML Macro: Integrating SAS ® and Google API and

Its Application in Mapping Manitoba's Health Data on Google Earth and Google Map. SAS Global Forum 2010.

Google Chart Tools / Interactive charts (aka Visualization API) Query Language Reference (Version 0.7). Available online: http://code.google.com/apis/visualization/documentation/querylanguage.html#plainText

Harris, Kriss. How To Generate 2, 3 and 4 Way Venn Diagrams with Drill Down Functionality within 4 minutes! SAS Global Forum 2008.

Li, Shiqun (Stan). Using SAS ® to Create Proportional Venn Diagrams. SAS Global Forum 2009

Massengill, Darrell. Google Maps and SAS/Graph ®.. SAS Global Forum 2010.

Roehl, William G. Bridging the Gap between the Google Analytics API and SAS ®. SAS Global Forum 2010.

Contact Information

Hillary Kruger

3040 E. Cornwallis Road

Cox 220

Durham, NC 27709

Phone: (919) 541-6243

E-mail: [email protected]


Recommended