pDistr: Proportion of total

View source: R/math.R

pDistrR Documentation

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

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)

soundgen documentation built on Sept. 29, 2023, 5:09 p.m.