View source: R/global-sensitivity.R
| global_sensitivity | R Documentation |
Quantifies how much each free parameter contributes to variation in a chosen scalar model output, sampling from the prior space. Implements two complementary methods:
Sobol' (Saltelli 2010): estimates first-order and total-effect variance-based sensitivity indices. More expensive but quantitatively interpretable as "share of output variance attributable to parameter i".
Morris (1991) elementary effects: cheaper
"screening" method that produces \mu^* (mean absolute
elementary effect, ranking importance) and \sigma (spread,
measuring nonlinearity / interactions).
global_sensitivity(
model,
priors,
target,
method = c("sobol", "morris"),
n_samples = 200L,
horizon = 20L,
data = NULL,
seed = NULL
)
model |
A |
priors |
Named list of |
target |
A character string naming the scalar output to analyse:
|
method |
|
n_samples |
Integer. Number of base samples (Sobol uses
|
horizon |
Integer. IRF horizon when |
data |
Required when |
seed |
Optional integer seed. |
An object of class "dsge_global_sensitivity" with the
computed indices and metadata. For Sobol the key fields are
S_first (first-order) and S_total (total-effect); for
Morris, mu_star and sigma. All indices are named by
parameter.
Saltelli, A. et al. (2010). Variance based sensitivity analysis of model output. Computer Physics Communications, 181: 259-270.
Morris, M.D. (1991). Factorial sampling plans for preliminary computational experiments. Technometrics, 33(2): 161-174.
nk <- dsge_model(
obs(p ~ beta * lead(p) + kappa * x),
unobs(x ~ lead(x) - (r - lead(p) - g)),
obs(r ~ psi * p + u),
state(u ~ rhou * u),
state(g ~ rhog * g),
fixed = list(beta = 0.99),
start = list(kappa = 0.1, psi = 1.5, rhou = 0.7, rhog = 0.9))
priors <- list(
kappa = prior("beta", shape1 = 2, shape2 = 8),
psi = prior("normal", mean = 1.5, sd = 0.25),
rhou = prior("beta", shape1 = 5, shape2 = 2),
rhog = prior("beta", shape1 = 5, shape2 = 2))
gs <- global_sensitivity(nk, priors, target = "sd:p",
method = "sobol", n_samples = 100, seed = 1)
print(gs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.