[R] cdf in R give probability of random variable

Ragia . ragia11 at hotmail.com
Fri Oct 21 18:30:07 CEST 2016


Dear Grooup

kindly

how can I plot  these  graphs in R..


Suppose that X is a discrete random variable with P(X = 0) = .25, P(X = 1) =
.125, P(X = 2) = .125, and P(X = 3) = .5. Graph the frequency function and
the cumulative distribution function of X.



my solution was:

x=c(0,1,3)
px=c(.25,.125,.5)
plot( x,px ,type="h"  ) # to plot the frequency  , is it correct

 how to plot the cdf?



thanks in advance


Ragia



	[[alternative HTML version deleted]]



More information about the R-help mailing list