# Sensitivity Analysis

OPTFEKO calculates upon termination of an optimisation, a sensitivity analysis of the goal function with relation to each parameter.

The sensitivity analysis is calculated using the particle swarm optimisation (PSO), generic algorithm (GA) or Simplex method, if sufficient information is available. The calculated sensitivity values are indicated on the screen output, and stored in the text .log file. If no sensitivity analysis is performed, the reason is indicated on the screen output, but no indication is written to the text .log file.

Figure 1 shows an example goal function f that varies as a function of the parameter x. The sensitivity with relation to the parameter x can be described by the following equation:

(1) $S\left(x\right)={\frac{\partial f}{\partial x}|}_{{x}_{0}±\Delta x}$
with $\Delta x$ equal to 1
(2) $\Delta x=0.01\left({x}_{\mathrm{max}}-{x}_{\mathrm{min}}\right)$
Solving the equation, however, gives a near zero value when the solution space is well converged. We therefore rather compute the second derivative from which the sensitivity parameter can be computed through integration
(3) $S\left(x\right)\approx {\frac{\partial f}{\partial x}|}_{{x}_{0}±\Delta x}\approx {\frac{{\partial }^{2}f}{\partial {x}^{2}}|}_{{x}_{0}}\cdot \Delta x$
to finally give the sensitivity with relation to x as
(4) $S\left(x\right)\approx {f}^{″}\left({x}_{0}\right)\cdot 0.001\left({x}_{\mathrm{max}}-{x}_{\mathrm{min}}\right)$

A sensitivity analysis will only be performed if at least 2N +1 samples are available for a problem with N parameters and these samples should all be within a 5% radius of the optimum. If the samples under consideration are scattered outside of a 5% radius of the optimum, the stored data is considered insufficient for proper sensitivity analysis. It should also be realised that as this computation makes use of already computed samples only, the accuracy of the reported sensitivity number depends on how well the algorithm has converged.