Re: [R] cdf in R give probability of random variable

2016-10-22 Thread Martin Maechler
> peter dalgaard > on Fri, 21 Oct 2016 22:10:22 +0200 writes: >> On 21 Oct 2016, at 20:23 , peter dalgaard >> wrote: >> >> In both cases it works out nicer if you do >> >> names(px) <- x >> barplot(px) > Um, unless of course you want the cdf as a st

Re: [R] cdf in R give probability of random variable

2016-10-21 Thread peter dalgaard
> On 21 Oct 2016, at 20:23 , peter dalgaard wrote: > > In both cases it works out nicer if you do > > names(px) <- x > barplot(px) > Um, unless of course you want the cdf as a step function, in which case check the help page for plot for possible values of the type= argument. -- Peter Dalg

Re: [R] cdf in R give probability of random variable

2016-10-21 Thread peter dalgaard
This looks like homework, but doing it in R might not be, so I'll give you the benefit of doubt... > On 21 Oct 2016, at 18:30 , Ragia . wrote: > > > 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

[R] cdf in R give probability of random variable

2016-10-21 Thread Ragia .
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,.1