Transmute weight to turn a generalized mean of a given order into a
generalized mean of any other order. Useful for calculating additive and
multiplicative decompositions for generalized-mean indexes.
See vignette("decomposing-indexes") for more details.
Arguments
- x
[numeric > 0]A strictly positive numeric vector.- weights
[numeric >= 0]A positive numeric vector of weights, the same length asx. The default is to equally weight each element ofx.- order
[numeric(1)]A finite number giving the order of the generalized mean. The default transmutes the weights for a geometric mean.- to
[numeric(1)]A finite number giving the order of the target generalized mean. The default computes weights for an arithmetic mean.- mean
[numeric(1)]A finite number giving the generalized mean ofxandweights, if known. The default computes this values.
Details
This function generalizes the additive and multiplicative decompositions for arithmetic and geometric indexes by Balk (2008, Chapter 4). It returns a value such that
gmean(x, w, r) == gmean(x, transmute_weights(x, w, r, s), s)Transmuting weights returns a value that is the same length as x,
so any missing values in x or weights will return NA.
Unless all values are NA, however, the result will still satisfy
the above identity when na.rm = TRUE.
See also
Other math functions:
emean(),
gmean(),
nested_gmean(),
scale_weights(),
transmute_weights2(),
update_weights()
