# Can I do SSA under RunDynam/RunMONASH etc?

You use RunDynam (or RunMONASH etc) to solve recursively dynamic models. These models are solved several times over several years, firstly to establish a base case and secondly to solve for a policy scenario. The results are the differences between the policy and the base case. This is a lot more complicated than the usual SSA (Systematic Sensitivity Analysis) which is done (via RunGEM or RunGTAP) for a single solve of a model.

## Not with respect to shocks

When solving the base case or policy, the model is solved several times, with different shocks and often different closures. We cannot imagine what it would mean to carry out SSA with resect to shocks in such a situation. For example, how much are you varying the shocks in year 1 and then in year 10, etc? So we don't think it is possible to do SSA with respect to shocks using RunDynam.

## SSA with respect to parameters is possible

But doing SSA with respect to parameters is easy to understand. The parameters are used when the model is solved for the first year. Because they are parameters their values are not changed in a simulation, so the same values of the parameters are used for all years of the solve - in the base or in the policy. Hence variations in the parameters (for all solves) does make sense.

We are grateful to Wojtek Szewczyk for raising this SSA question.

The idea is to select (using Gaussian quadratures) an appropriate number (say N) of different sets of parameters and then to completely solve the model (all years of the base and policy - also the rerun if you do that) N times, one complete solve for each of the N sets of parameters. You will get N different base cases and policy runs and N different sets of results (differences between the policy and the base).

### Use RunGEM to create and store the different sets of parameters

To do this in practice, use the SSA capabilities of RunGEM to create and store the appropriate sets of different parameter values. To do this, load your model and any simulation into RunGEM, carry out the simulation and then do SSA with respect to the parameters. As you do that, ask RunGEM to keep the separate sets of input files (that is, the separate parameter values used); follow the standard procedure for doing that.

### Carrying out the different complete solves via RunDynam

For simplicity, suppose below that you only have one logical file containing parameters which are varying. [If there are two or more, the procedure is much as below, just a little more complicated.] Suppose that the logical file name containing the varying parameters is "basedata". Then the N different ones produced by RunGEM will have names basedata1.dat, basedata2.dat and so on.

First replace the logical file basedata used for the normal simulation by basedata1.dat in the Data part of the Model/Data page. Then change the sim name for the base (do this on the Sim Overview page). For example, make it SA1. Save the simulation details and then solve all years of the base and policy (and rerun if you do that). The results will all begin with SA1B so will not overwrite the results of the original base and policy.

Now replace the logical file basedata used for the normal simulation by the second file basedata2.dat in the Data part of the Model/Data page. Change the sim name for the base to SA2.Save the simulation details and then solve all years of the base and policy (and rerun if you do that). The results will all begin with SA2B so will not overwrite the results of the original base and policy or the SA1 base case.

Repeat for the remaining N-2 versions of basedatax.dat.

Then you will have N different sets of results. You will need to calculate the usual mean and standard deviation for selected results by hand (since RunDynam does not automate that for you in the way that RunGEM does). For both Stroud and Liu quadratures, the weights are equal. So, to get the mean of a policy result (or a deviation of policy from base), add up the N different results and divide by N. To get the standard deviation, use the usual formula for that.

Lo and behold, with a bit of work, you have been able to carry out SSA with respect to parameters.

Go back to
GEMPACK FAQ Page