In: Statistics and Probability
Five people, including you and a friend, line up at random. The random variable X denotes the number of people between yourself and your friend. Use R to show this distribution in a graph.
PDF Plot
CDF PLot
R-Code:
x.pf<-c(4/10,3/10,2/10,1/10)
barplot(dist,xlab="X",ylab="Probability Function",
names.arg=c("0","1","2","3"))
dist<-c(4/10,7/10,9/10,10/10)
plot(ecdf(dist),names.arg=c("0","1","2","3"))