powerscale-gradients {priorsense} | R Documentation |
Power-scale gradients
Description
Calculate the numerical derivative of posterior quantities/divergence with respect to power-scaling the specified component (prior or likelihood). This is done using importance sampling (and optionally moment matching).
Usage
powerscale_gradients(x, ...)
## Default S3 method:
powerscale_gradients(x, ...)
## S3 method for class 'priorsense_data'
powerscale_gradients(
x,
variable = NULL,
component = c("prior", "likelihood"),
type = c("quantities", "divergence"),
lower_alpha = 0.99,
upper_alpha = 1.01,
div_measure = "cjs_dist",
measure_args = list(),
moment_match = FALSE,
k_threshold = 0.5,
resample = FALSE,
transform = NULL,
prediction = NULL,
scale = FALSE,
prior_selection = NULL,
likelihood_selection = NULL,
...
)
Arguments
x |
Model fit or draws object. |
... |
Further arguments passed to functions. |
variable |
Variables to compute sensitivity of. If NULL (default) sensitivity is computed for all variables. |
component |
Component to power-scale (prior or likelihood). |
type |
type of sensitivity to measure ("distance", "quantity"). Multiple options can be specified at the same time. |
lower_alpha |
lower power to scale component by, should be < 1 (default is 0.9). |
upper_alpha |
upper power to scale component by, should be > 1 (default is 1.1). |
div_measure |
The divergence measure to use. The following methods are implemented:
|
measure_args |
Named list of further arguments passed to divergence measure functions. |
moment_match |
Logical; Indicate whether or not moment
matching should be performed. Can only be TRUE if |
k_threshold |
Threshold value for Pareto k values above which the moment matching algorithm is used. Default is 0.5. |
resample |
Logical; Indicate whether or not draws should be resampled based on calculated importance weights. |
transform |
Indicate a transformation of posterior draws to perform before sensitivity analysis. Either "scale" or "whiten". |
prediction |
Function taking the model fit and returning a draws_df of predictions to be appended to the posterior draws |
scale |
logical scale quantity gradients by base posterior standard deviation. |
prior_selection |
Numeric vector specifying which priors to consider. |
likelihood_selection |
Numeric vector specifying which likelihoods to consider. |
Value
Maximum of the absolute derivatives above and below alpha = 1.
Examples
ex <- example_powerscale_model()
drw <- ex$draws
powerscale_gradients(drw)