File:Simpson's paradox.svg

From Wikimedia Commons, the free media repository

Jump to: navigation, search

Simpson's_paradox.svg(SVG file, nominally 500 × 346 pixels, file size: 9 KB)

[edit] Summary

Description

An illustration of w:en:Simpson's paradox

Date

15 August 2007(2007-08-15)

Source

Own work

Author

Schutz

Permission
(Reusing this image)

See below.

The graphic was created by User:Schutz for Wikipedia on 15 August 2007, using the R statistical project. The program that generated and exported the graphic is given below; the postscript file was converted to SVG with the pstoedit command and the layout was slightly modified using Inkscape before upload.

The example is taken from w:en:Simpson's paradox#Description of the paradox.

 success1 <- c( 60,  1)
 total1   <- c(100, 10)
 success2 <- c(  9, 30)
 total2   <- c( 10,100)
 
 ratios1 <- success1/total1
 ratios2 <- success2/total2
 
 postscript("simpson.eps", paper="special", height=4, width=6, horizontal=F)
 
 par(mfrow=c(2,1))
 par(las=1)
 par(yaxs="i")
 par(xpd=NA)
 par(cex=1.3)
 
 par(mar=c(2.1, 2.6, 0.7, 0.6))
 plot.new()
 plot.window(xlim=range(ratios1, ratios2)+c(-1,1)*0.05*diff(range(ratios1,ratios2)),
            ylim=c(0,max(total1, total2)))
 
 width  <- (par("usr")[2]-par("usr")[1])/15
 height <- (par("usr")[4]-par("usr")[3])/5
 
 rect( ratios1[1]-width/2, 0, ratios1[1]+width/2, total1[1], col="red")
 rect( ratios1[2]-width/2, 0, ratios1[2]+width/2, total1[2], col="blue")
 segments ( min(ratios1)-width/2, 0, max(ratios1)+width/2, 0, lwd=2)
 ratiototal1 <- sum(success1)/sum(total1)
 
 polygon(c(ratiototal1, ratiototal1-width/2, ratiototal1+width/2),
         c(0, -height, -height), col="black")
 
 axis(2)
 axis(1, at=c(ratios1))
 
 plot.new()
 plot.window(xlim=range(ratios1, ratios2)+c(-1,1)*0.05*diff(range(ratios1,ratios2)),
             ylim=c(0,max(total1, total2)))
 
 rect( ratios2[1]-width/2, 0, ratios2[1]+width/2, total2[1], col="red")
 rect( ratios2[2]-width/2, 0, ratios2[2]+width/2, total2[2], col="blue")
 segments ( min(ratios2)-width/2, 0, max(ratios2)+width/2, 0, lwd=2)
 
 ratiototal2 <- sum(success2)/sum(total2)
 
 polygon(c(ratiototal2, ratiototal2-width/2, ratiototal2+width/2),
         c(0, -height, -height), col="black")
 
 axis(2)
 axis(1, at=c(ratios2))
 
 dev.off()

[edit] Licensing

I, the copyright holder of this work, hereby publish it under the following licenses:
GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Afrikaans | Alemannisch | Aragonés | العربية | Asturianu | Беларуская | Беларуская (тарашкевіца) | Български | বাংলা | ইমার ঠার/বিষ্ণুপ্রিয়া মণিপুরী | Brezhoneg | Bosanski | Català | Cebuano | Česky | Dansk | Deutsch | Ελληνικά | English | Esperanto | Español | Eesti | Euskara | فارسی | Suomi | Français | Gaeilge | Galego | עברית | Hrvatski | Magyar | Հայերեն | Bahasa Indonesia | Ido | Íslenska | Italiano | 日本語 | ქართული | ភាសាខ្មែរ | 한국어 | Kurdî / كوردی | Latina | Lëtzebuergesch | Lietuvių | 文言 | Македонски | Bahasa Melayu | Malti | Nnapulitano | Plattdüütsch | Nederlands | ‪Norsk (nynorsk)‬ | ‪Norsk (bokmål)‬ | Occitan | Polski | Português | Română | Русский | Slovenčina | Slovenščina | Shqip | Српски / Srpski | Svenska | Kiswahili | తెలుగు | ไทย | Tagalog | Türkçe | Українська | اردو | Vèneto | Tiếng Việt | Volapük | Yorùbá | 中文 | ‪中文(简体)‬ | ‪中文(繁體)‬ | +/−

Creative Commons license
Creative Commons Attribution iconCreative Commons Share Alike icon
This file is licensed under the Creative Commons Attribution ShareAlike 3.0, Attribution ShareAlike 2.5, Attribution ShareAlike 2.0 and Attribution ShareAlike 1.0 License. In short: you are free to share and make derivative works of the file under the conditions that you appropriately attribute it, and that you distribute it only under a license identical to this one. Official license.

Afrikaans | Беларуская | Български | Català | Česky | Dansk | Deutsch | Ελληνικά | English | Esperanto | Español | Eesti | Euskara | Estremeñu | Suomi | Français | עברית | Hrvatski | Հայերեն | Italiano | 日本語 | 한국어 | Lietuvių | Македонски | Plattdüütsch | Nederlands | ‪Norsk (bokmål)‬ | Occitan | Polski | Piemontèis | Português | Română | Русский | Slovenčina | ไทย | Vèneto | Tiếng Việt | 中文 | ‪中文(简体)‬ | ‪中文(繁體)‬ | +/−

You may select the license of your choice.



Rlogo.png

This chart was created with R.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current18:43, 15 August 2007Thumbnail for version as of 18:43, 15 August 2007500×346 (9 KB)Schutz (Talk | contribs) ({{Information |Description=An illustration of w:en:Simpson's paradox |Source=self-made |Date=15 August 2007 |Author= Schutz }} )

The following page links to this file:

Global file usage

The following other wikis use this file: