Here you will find daily news and tutorials about R, contributed by over 750 bloggers.
There are many ways to follow us - By e-mail:On Facebook: If you are an R blogger yourself you are invited to add your own R content feed to this site (Non-English R bloggers should add themselves- here)

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")

Related

To leave a comment for the author, please follow the link and comment on their blog: Statistics Blog » r.