Learn R Programming

wINEQ (version 1.2.1)

LowerSum: Weighted lower sum

Description

Computes weighted sum of values not greater then a quantile derived for the given probability.

Usage

LowerSum(X, W = rep(1, length(X)), p = 0.5)

Value

The weighted sum of values not greater then a quantile.

Arguments

X

is a numeric data vector

W

is a vector of weights

p

is a probability to derive corresponding quantile

Details

Calculates weighted sum of values not greater then a quantile derived for the given probability based on cumulative distribution. Linear interpolation is applied to deal with a frequency distribution.

Examples

Run this code
# Suppose X represents incomes. Compare total incomes with incomes of poorer half of population.
X=1:10
W=10:1
sum(W*X)
LowerSum(X,W,0.5)


Run the code above in your browser using DataLab