Accumulation histogram with percentage along the y axis

I want to build a cumulative histogram in project R, where the percentage is shown along the Y-axis, not the frequency

x <- c(rnorm(100), rnorm(50, mean=2,sd=.5)) h <- hist(x, plot=FALSE, breaks=20) h$counts <- cumsum(h$counts) h$density <- cumsum(h$density) plot(h, freq=TRUE, main="(Cumulative) histogram of x", col="white", border="black") box() 

thanks for the help

+4
source share
3 answers

Isn't this a graph of the empirical cumulative distribution function? As in

 plot(ecdf(x)) 

which produces:

enter image description here

+17
source

Also try:

plot( sort(x), (1:length(x))/length(x), type="l" )

+2
source

For a histogram of a column graph, you will need:

 x <- c(rnorm(100), rnorm(50, mean=2,sd=.5)) hist( x,plot=FALSE) -> h # do a histogram of y and assign its info to h h$counts <- cumsum(h$counts)/sum(h$counts) # replace the cell freq.s by cumulative freq.s plot( h ) # plot a cumulative histogram of y 

Source: http://influentialpoints.com/Training/basic_statistics_cumulative_plot.htm

+1
source

Source: https://habr.com/ru/post/1445550/


All Articles