quantfun: Functions to compute (weighted) quantiles

Description Usage Arguments Details

View source: R/quantfun.R

Description

This set of functions allows you to compute weighted quantiles. qq returns the quantile from a sequence of values with associated probabilities. qfun computes unweighted quantiles using qq, and wqfun computes the weighted quantiles given some weight for the different values. quantfun computes weighted quantiles for an array of input data with equal weight to rows (and allowing for missing values in the columns).

Usage

1
2
3
4
5
6
7
quantfun(x, initw = 1, quants = c(0.1, 0.9, 0.5), type = 1)

qq(x, px, p)

qfun(x, p, type = 1)

wqfun(x, weights, p, type = 1)

Arguments

x

numerical input (vector or matrix for quantfun)

initw

initial weight for individual rows in x

quants

multiple quantiles to be computed

type

Assumptions on how quantiles are calculated (see details)

px

probability of values in x

p

quantile to be computed computed

weights

weights for the values in x

Details

The different types govern the probabilities associated with the sequence of ordered values. type = 1 sets the probability of the minimum to 0.5/n where n is the number of values in x, whereas type = 2 sets the probability of the minimum to 0. In both cases the 0th and 100th percentile correspond to the minimum and maximum of the values in x.


jonasbhend/geoutils documentation built on May 19, 2019, 7:27 p.m.