soundgen (version 1.5.0)

pDistr: Proportion of total

Description

Internal soundgen function.

Usage

pDistr(x, quantiles)

Arguments

x

numeric vector of non-negative real numbers

quantiles

quantiles of the cumulative distribution

Details

Calculates the values in the input distribution that contain particular proportions of the sum of all values in the input distribution.

Examples

Run this code
# NOT RUN {
x = rnorm(100)
x = x - min(x)  # must be non-negative
hist(x)
v = soundgen:::pDistr(x, quantiles = c(.5, .8, .9))
sum(x[x > v['0.5']]) / sum(x)
sum(x[x > v['0.9']]) / sum(x)
# }

Run the code above in your browser using DataLab