1.1. Uncertainty Quantification
Uncertainty quantification, in the narrow sense used here, is forward propagation: you have a sample of parameter vectors representing the uncertainty in the inputs, and you want the induced distribution of the model’s outputs – steady states, impulse responses, theoretical moments, forecasts, variance and historical decompositions, and so on. (For which inputs drive that output uncertainty, see the GSA tools.)
1.1.1. Where the parameter draws come from
Posterior draws – after estimation, sample the posterior with one of the samplers of
rise.engine.estimation.rsamplers(see Estimation and Posterior sampling):results{k}.pop, chaink, is a struct array with the parameter vector of each draw in its fieldx. For a VAR (reduced-form, structural, proxy or pooled panel, constant or switching),[mpost,draws,results]=sample_posterior(mest,N)drawsNvectors from the posterior by Metropolis-within-Gibbs and returns the model carrying them asNparameterizations;resultshas the draws in the format of the samplers (results{1}.pop). See Which sampler? in Posterior sampling.Prior draws – with priors set on the model,
[draw,mi]=draw_parameter(m,'prior')makes one draw from the priors:drawis the cell{names,values}andmithe model with the draw pushed in. Repeat it for a sample; useful for prior predictive analysis.A design over a calibration range – when you only have ranges (no distribution), sweep them with a quasi-Monte-Carlo low-discrepancy design:
rise.engine.numerics.quasi_monte_carlo.sobol(lb,ub,N)returnsNpoints of a Sobol sequence in the box (the package also hashaltonandlatin_hypercube) – the same sampling engine the GSA tools use.
randsample is not a source of parameter draws: randsample(m,N,K)
simulates K time series of length N from the model at its current
parameters.
1.1.2. Propagating uncertainty through the model
posterior_sample applies a function of the model to draws of the
parameters, re-parameterizing the model at each draw, and returns a cell
with one result per draw:
pop=results{1}.pop; % draws from a sampler
myirfs=posterior_sample(mest,pop,@irf,1000); % 1000 of them
vd=posterior_sample(mest,pop,@(m)variance_decomposition(m),1000);
The function receives the model at a draw; put any other argument inside the handle. A draw at which the function fails is replaced by another.
A model carrying several parameterizations – the output of
sample_posterior, for instance – needs no such loop: irf,
forecast and the decompositions return one result per
parameterization, a sample of paths that fanchart / plot_fanchart
(and the other plotting helpers) summarize:
mpost=sample_posterior(mest,1000); % reduced-form VAR: 1000 posterior draws
myirfs=irf(mpost);
out=fanchart(myirfs.(shock).(var),[30,50,68,90]); % credible bands
plot_fanchart(out)
(the reduced-form VAR chapter uses the same pattern).
1.1.3. From propagation to sensitivity
Once you have an input sample together with the corresponding output values, the two GSA tools tell you which inputs matter:
Monte Carlo filtering – partition the draws by whether the output satisfies a chosen condition (“behave” vs “non-behave”) and look for parameters whose conditional distributions differ between the two groups;
high-dimensional model representation – fit a low-order surrogate of the input-to-output map and read off variance-based (Sobol-type) first-order and total sensitivity indices (and use the surrogate as a fast emulator).