ess.weights: Measures of weight non-uniformity

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ess.weights.R

Description

These functions calculate heuristic measures of the effective number of samples given a set of weights (probabilities).

Usage

1
2
3
ess.weights(weights, engine="R")
cov.weights(weights, engine="R")
ent.weights(weights, engine="R")

Arguments

weights

a vector of weights (probabilities)

engine

run using "R" or "C" code

Details

‘ess.weights’ calculates the effective sample size, namely ‘1/(sum(weights^2))’. ESS has a minimum of 1 and a maximum equal to ‘length(weights)’ when weights are uniform.

‘cov.weights’ calculates the coefficient of variation of the weights, namely ‘var(weights)/mean(weights)^2’. CoV has a minimum of 0 when weights are uniform and a maximum equal to ‘length(weights)’.

‘ent.weights’ calculates the entropy of the weights, namely ‘-sum(weights * log2(weights))’. Entropy has a minimum of 0 and a maximum equal to ‘log2(length(weights))’ when weights are uniform. (For numerical stability, the log term is actually calculated with ‘weights+.Machine$double.eps’, which can cause the observed minimum to be less than 0.)

Value

a scalar indicating how uniform the weights are

Author(s)

Jarad Niemi

References

Liu, J. (2004) _Monte Carlo Strategies in Scientific Computing_

Doucet, A., dr Freitas, N., and Gordon, N. (2001) _Sequential Monte Carlo Methods in Practice_

See Also

resample

Examples

1
2
3
4

smcUtils documentation built on May 29, 2017, 1:15 p.m.