Skip to contents

Compute midpoint fractional ranks after sorting x in ascending order and normalizing positive weights to sum to one. Observations with the same x value share the weighted midpoint rank of their combined tied block.

Usage

rank_wt(x, wt)

Arguments

x

A numeric vector to rank.

wt

A numeric vector of case weights with the same length as x.

Value

A numeric vector of weighted fractional ranks in (0, 1), one for each retained observation. The output is ordered like the retained inputs after removing cases with missing x, missing wt, or wt <= 0.

Details

Observations with missing x, missing wt, or non-positive wt are removed before ranking. The resulting ranks are useful as a low-level building block for concentration-index calculations and related inequality measures.