get_noisy_weights {COINr} | R Documentation |
Noisy replications of weights
Description
Given a data frame of weights, this function returns multiple replicates of the weights, with added noise. This is intended for use in uncertainty and sensitivity analysis.
Usage
get_noisy_weights(w, noise_specs, Nrep)
Arguments
w |
A data frame of weights, in the format found in |
noise_specs |
a data frame with columns:
|
Nrep |
The number of weight replications to generate. |
Details
Weights are expected to be in a data frame format with columns Level
, iCode
and Weight
, as
used in iMeta
. Note that no NA
s are allowed anywhere in the data frame.
Noise is added using the noise_specs
argument, which is specified by a data frame with columns
Level
and NoiseFactor
. The aggregation level refers to number of the aggregation level to target
while the NoiseFactor
refers to the size of the perturbation. If e.g. a row is Level = 1
and
NoiseFactor = 0.2
, this will allow the weights in aggregation level 1 to deviate by +/- 20% of their
nominal values (the values in w
).
This function replaces the now-defunct noisyWeights()
from COINr < v1.0.
Value
A list of Nrep
sets of weights (data frames).
See Also
-
get_sensitivity()
Perform global sensitivity or uncertainty analysis on a COIN
Examples
# build example coin
coin <- build_example_coin(up_to = "new_coin", quietly = TRUE)
# get nominal weights
w_nom <- coin$Meta$Weights$Original
# build data frame specifying the levels to apply the noise at
# here we vary at levels 2 and 3
noise_specs = data.frame(Level = c(2,3),
NoiseFactor = c(0.25, 0.25))
# get 100 replications
noisy_wts <- get_noisy_weights(w = w_nom, noise_specs = noise_specs, Nrep = 100)
# examine one of the noisy weight sets, last few rows
tail(noisy_wts[[1]])