[edit] Summary
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:
You may select the license of your choice.
|
 |
This chart was created with R. |
Click on a date/time to view the file as it appeared at that time.
The following pages on the English Wikipedia link to this file (pages on other projects are not listed):