File:Simpson's paradox.svg
From Wikimedia Commons, the free media repository
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 |
| Source |
Own work |
| Author | |
| 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
|
This chart was created with R. |
File history
Click on a date/time to view the file as it appeared at that time.
| Date/Time | Thumbnail | Dimensions | User | Comment | |
|---|---|---|---|---|---|
| current | 18:43, 15 August 2007 | 500×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 }} ) |
- Edit this file using an external application (See the setup instructions for more information)
File links
The following page links to this file:
Global file usage
The following other wikis use this file:
- Usage of Simpson's paradox.svg on enwiki