% Simpson's paradox
% Your name
% 2011-07-11
# Overview
In probability and statistics, Simpson's paradox (or the Yule-Simpson effect) is a paradox
in which a correlation present in different groups is reversed when the groups are
combined. This result is often encountered in social-science and medical-science statistics,
and it occurs when frequency data are hastily given causal interpretations.
Simpson's Paradox disappears when causal relations are brought into consideration
(see Implications to decision making).
# Example
Simpson's paradox for continuous data: a positive trend appears for two
separate groups (blue and red), a negative trend (black, dashed) appears when the data are combined.
<<plot, fig=TRUE>>=
x1 <- c(1,2,3,4)
y1 <- x1 + 5
x2 <- x1 + 7
y2 <- x2 - 7
x <- c(x1,x2)
y <- c(y1,y2)
par(las=1)
par(mar=c(3,3,0.5,0.5))
par(mgp=c(2,1,0))
plot(x,y, cex=2, pch=21,
col=rep(c("blue", "red"), each=4), bg=rep(c("lightblue", "pink"), each=4),
xlim=range(x)+c(-2,2), ylim=range(y)+c(-2,2))
abline(lm(y1 ~ x1), col="blue", lwd=2)
abline(lm(y2 ~ x2), col="red", lwd=2)
abline(lm(y ~ x), lwd=2, lty=2)
@
# References
The text is composed from parts of [Wikipedia](http://en.wikipedia.org/wiki/Simpson's_paradox).