(This article was first published on

**Statistics Blog » r**, and kindly contributed to R-bloggers)More playing around with R. To create the graph above, I sampled 100 times from two different normal distributions, then plotted the ratio of times that the first distribution beat the second one on the y-axis. The second distribution always had a mean of 0, the mean of first distribution went from 0 to 4, this is plotted on the x-axis.

Here is my code:

1 2 3 4 5 6 7 8 9 10 11 | AbeatsB <- function(a,b) { sum(a>b)/length(a) } x = seq(0,4,.001) y = c() for (i in x) { y = c(y,AbeatsB(rnorm(100,i),rnorm(100,0))) } plot(x,y,pch=".",cex=2,col="blue") |

To

**leave a comment**for the author, please follow the link and comment on his blog:**Statistics Blog » r**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...