Description Usage Arguments Details Value Author(s) References See Also Examples
These functions calculate heuristic measures of the effective number of samples given a set of weights (probabilities).
1 2 3 | ess.weights(weights, engine="R")
cov.weights(weights, engine="R")
ent.weights(weights, engine="R")
|
weights |
a vector of weights (probabilities) |
engine |
run using "R" or "C" code |
‘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.)
a scalar indicating how uniform the weights are
Jarad Niemi
Liu, J. (2004) _Monte Carlo Strategies in Scientific Computing_
Doucet, A., dr Freitas, N., and Gordon, N. (2001) _Sequential Monte Carlo Methods in Practice_
1 2 3 4 | ws = renormalize(runif(10))
ess.weights(ws)
cov.weights(ws)
ent.weights(ws)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.