How would you differentiate between the quantile function and cumulative percentage below? Note the treatment of numerics as categorical when grouping is performed.
When would you use one over the other?
Am i right to read the first (quantile ) as 90% of the population would have a number below 13.6 and the 2nd (cumulative perc) as 90% of the number would be 4 and below?
The difference between the 2 being, the quantile estimates, whereas the cumulative perc does not?
nums = c(0, 1,1,1, 3,3,3,3, 4,100)
quantile(nums,seq(.1, 1, .1))
# 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
# 0.9 1.0 1.0 2.2 3.0 3.0 3.0 3.2 13.6 100.0
library(dplyr)
data.frame(nums = nums) %>%
group_by(nums) %>%
summarise(freq = n()) %>%
ungroup() %>%
mutate(pct = freq / sum(freq), cumsum_pct = cumsum(pct))
# A tibble: 5 x 4
# nums freq pct cumsum_pct
# <dbl> <int> <dbl> <dbl>
# 1 0 1 0.1 0.1
# 2 1 3 0.3 0.4
# 3 3 4 0.4 0.8
# 4 4 1 0.1 0.9
# 5 100 1 0.1 1
?quantile
, and study the meaning of itstype
argument. $\endgroup$