Simulation::Sensitivity is a general-purpose sensitivity analysis tool. Given a user-written calculating function, a "base-case" of parameters, and a requested input sensitivity delta, this module will carry out a sensitivity analysis, capturing the output of the calculating function while varying each parameter positively and negatively by the specified delta. The module also produces a simple text report showing the percentage impact of each parameter upon the output.

The user-written calculating function must follow a standard form, but may make any type of computations so long as the form is satisfied. It must take a single argument -- a hash reference of parameters for use in the calculation. It must return a single, numerical result.

new takes as its argument a hash with three required parameters. calculation must be a reference to a subroutine and is used for calculation. It must adhere to the usage guidelines above for such functions. parameters must be a reference to a hash that represents the initial starting parameters for the calculation. delta is a percentage that each parameter will be pertubed by during the analysis. Percentages should be expressed as a decimal (0.1 to indicate 10%).

The parameter values in a Simulation::Sensitivity object may be retreived or modified using get/set accessors. With no argument, the accessor returns the value of the parameter. With an argument, the accessor sets the value to the new value and returns the new value.

This method returns a hash reference containing the results of the sensitivity analysis. The keys of the hash are the same as the keys of the parameters array. The values of the hash are themselves a hash reference with each key representing a particular case in string form (e.g. "+10%" or "-10%") and the value equal to the result from the calculation. A simple example would be:

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.