These routines implement the Hornberger-Spear-Young method of Global Sensitivity Analysis (GSA) or Regionalised Sensitivity Analysis (RSA) with enhancements to looking at differences between multiple classes of model outputs.
Libraries
No special library routines are required for these routines
Download
Download sample code and data file for GSA routines [Here]
Procedure
The Input data file
The forms of sensitivity analysis explored here make use of a file of model results from Monte Carlo experiments stored in a data file. This should have the form (explanations of each line given as comments: npar is number of parameters, nlik is number of likelihood measures, nvar is number of predicted variables, nrun is number of model realisations):
“Slapton Wood catchment” # title
4,3,7,1000 # npar,nlik,nvar,nrun
” M “,.02,.05 # parameter name, min and max values
” LnTo “,1,10
” SRmax “,.005,.05
” SRinit “,0,1
” Eff ” # likelihood measure names, index=1
” 1/SLE ” # index=2
” 1/SAE ”
” Vol. Q ” # predicted variable names, index =nlik+1
” Max Ac% ” # index=nlik+2
” % Ac Q ”
” % BF Q ”
“t=100”
“t=290”
“t=800”
2.594035E-02,5.459364,2.187394E-02,.8582671,.8107379,2.647838E-02……#values of parameters, likelihoods, and predictions for each model run.
Dotty Plots
A very basic way of testing the sensitivity to different types of output is to make “dotty plots” which are simple scatter plots of parameter value against model output (either a likelihood value or a value for a predicted variable). The routine to call the plots is:
dotty (“filename”, index, threshold)
where index is the selected likelihood or predicted variable index and threshold is the chosen limit between the behavioural and nonbehavioural classes.
Dotty plots are found in many GLUE papers and often show that when parameter values are plotted against likelihoods, good fits to the data are found across a wide range of parameter values (the equifinality issue).
It is worth remembering, however, that the dotty plot is a projection of points on the response surface in the model space onto single parameter axes. This means that any interactions between different parameters in producing a good model fit will not be revealed by this form of plot. For example a long sharp ridge in the response surface (characteristic of strongly interacting parameters) would appear as equally good models in the dotty plot.
HSY Generalised Sensitivity Analysis. (See Section 3.5 in Environmental Modelling: An Uncertain Future?)
The following routines written in R allow the user to carry out HSY GSA given either likelihood evaluations or single predicted variables from multiple Monte Carlo realisations of a model run with different parameter sets. Both approaches use the same input data file format.
In Hornberger/Spear/Young GSA the model runs are split into different classes depending on the value of a likelihood or predicted variable value.
Two variants are provided: the first follows the original approach of Hornberger and Spear (1981) in using two classes (behavioural and non-behavioural) depending on a simple threshold. This may be called as:
hsy_gsa (“filename”, index, threshold)
where index is the selected likelihood or predicted variable index and threshold is the chosen limit between the behavioural and nonbehavioural classes.
The results are plotted as cumulative distributions of parameter values in each class for each parameter.
A large difference between the distributions for a parameter indicates that the simulations are sensitive to that parameter.
A somewhat more detailed impression of the sensitivity for each parameter can be obtained by using more than one class. The routine
gsa_n_classes (“filename”, index, nclasses)
where nclasses is the number of classes to be used in subdividing the model runs on the basis of the value of likelihood or predicted value.