The estimators of an importance sample (simulate_events_weighted()):
the self-normalised mean sum(w * x) / sum(w), and the VaR and TVaR of
the distribution putting mass w_i / sum(w) on draw i, each with a
standard error by batch means (the draws split, in order, into
batches runs, each estimated alone). Equal weights give the plain
estimators.
Usage
weighted_tail(values, weights, p, batches = 20)
Arguments
- values
The draws.
- weights
One a draw, non-negative, with a positive sum.
- p
Probability levels.
- batches
Number of batches for the standard errors.
Value
A data frame with a row a level: p, var, var_se, tvar
and tvar_se; attributes mean, mean_se, mean_weight and
effective_sample_size (sum(w)^2 / sum(w^2)).
Examples
weighted_tail(c(1, 2, 3), c(1, 1, 2), 0.5, batches = 3)
#> p var var_se tvar tvar_se
#> 1 0.5 2 0.5773503 3 0.5773503