简体   繁体   English

如何将 plot a 累积分布到 R

[英]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.目前,我被要求 plot 在 R 中的累积分布。我不知道如何 go 。 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.你有一个离散分布,你可以把它写出来,不需要ecdf()注意我使用的是你在问题中发布的数字中的百分比。 you can also write this as a function if you case become more complicated but I started here.如果你的情况变得更复杂,你也可以把它写成 function 但我从这里开始。

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)
 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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