简体   繁体   中英

How to plot a Cumulative distribution in R

enter image description here

Currently, I am asked to plot the cumulative distribution in R. I have no idea how to go about it. Can anyone help me out here?

you have a discrete distribution you can write it out and don't need ecdf() Note I am using the percentages from the figure you posted in the question. you can also write this as a function if you case become more complicated but I started here.

val <- c(0 , 1/10, 1/10,1/10,3/10, 3/10, 6/10,6/10, 10/10)

x <- 0:8


yz <- data.frame( x=x,val = val)


plot(yz$x, yz$val)
 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM