wtd.median: Weighted Median

View source: R/wtd.median.R

wtd.medianR Documentation

Weighted Median

Description

Compute weighted median.

Usage

wtd.median(x, na.rm = FALSE, weight = FALSE)

Arguments

x

Vector of data, same length as weight

na.rm

Logical: Should NAs be stripped before computation proceeds?

weight

Vector of weights

Details

Uses a simple algorithm based on sorting.

Value

Returns an empirical .5 quantile from a weighted sample.


statnet/ergm documentation built on April 17, 2024, 12:21 p.m.