# Simulation tools

## Monte-Carlo analysis

Recalculates the current worksheet for the specified number of replicates. If the worksheet includes random variables, a new result will be obtained for each replicate. Statistics for a column of dependent cells are collected and summary statistics (mean, variance, and confidence limits) are collected after a given number of replicates. The procedure also collects the number of times that values in the dependent range exceed a range of test values (this allows, for example, calculation of approximate P-values for resampling statistics). Together with the routines for resampling and generation of random variables, this procedure allows calculation of bootstrap statistics and randomisation tests for arbitrarily complex models.

## Sensitivity analysis

Numerically computes sensitivity of dependent cells to small perturbations in a range of parameters. This routine perturbs each of the parameters by a small amount and then recalculates the worksheet to determine how the dependent parameters change. For some reason, the routine does not work unless you have Excel 2000 or Excel 97 service release 2 installed. Note: To calculate the sensitivity of the eigenvalues to matrix elements use the SENSITIVITY function.

## Integrate a system of ODEs

This routine numerically integrates a system of ordinary differential equations using a either a 4th order Runge-Kutta algorithm with a fixed number of steps, or Euler’s method. The integration is performed entirely in the PopTools DLL (RANDEVS.DLL) with the results being returned to Excel as an array formula. Because the step size is not adaptive, the algorithm best suited to “well behaved” systems. The algorithm can be unstable if the system is stiff, although you can usually get around this by choosing a smaller step size - albeit at the expense of some computational time.

## Numerical projection

Simulation of a deterministic or stochastic process. By using this routine, you need only specify in a worksheet how the population makes a transition from the state at time t to t + 1; you do not need to enter lots of columns with the numbers in each state at each time. You must enter the initial state as N(t), which must be a column of values. The state at the next time period is N(t + 1) and can depend on an arbitrarily complex process specified in the worksheet. N(t + 1) must also be arranged as a column, but the cells can (indeed, should) contain formulae. The routine works by repeatedly copying the values in N(t + 1) to N(t) and then forcing a recalculation and storing the new values of N(t + 1). The original values are restored at the end of the procedure, but you should always save the worksheet before invoking this routine.

## Summary Stats

See Summary stats.