Subsections


Normal Distribution approximations.

We will in general not go into detail about more standard numerical problems not connected to finance, there are a number of well known sources for such, but we show the example of calculations involving the normal distribution.

The normal distribution function

The nurmal distribution function

\begin{displaymath}n(x) = e^{-\frac{x^2}{2}} \end{displaymath}

is calculated as
\begin{program}
% latex2html id marker 4918\caption{The normal distribution fu...
...}
\lgrindfile{/home/bernt/2003_algor/all_cc_tex_files/normdist.cc}
\end{program}

The cumulative normal distribution

The solution of a large number of option pricing formulas are written in terms of the cumulative normal distribution. For a random variable $x$ the cumulative probability is the probability that the outcome is lower than a given value $z$. To calculate the probability that a normally distubuted random variable with mean $0$ and unit variance is less than $z$, $N(z)$, one have to evaluate the integral

\begin{displaymath}\mathrm{Prob}(x\le z)= N(z) = \int_{-\infty}^z n(x)dx = \int_{-\infty}^z e^{-\frac{x^2}{2}} dx \end{displaymath}

There is no explicit closed form solution for calculation of this integral, but a large number of well known approximations exists. Abramowiz and Stegun (1964) is a good source for these approximations. The following is probably the most used such approximation, it being pretty accurate and relatively fast. The arguments to the function are assumed normalized to a (0,1 ) distribution.


\begin{program}
% latex2html id marker 4923\caption{The cumulative normal}
\lgrindfile{/home/bernt/2003_algor/all_cc_tex_files/cum_normal.cc}
\end{program}

Multivariate normal

The normal distribution is also defined for several random variables. We then characterise the vector of random variables

\begin{displaymath}\mathbf{X} = \left[ \begin{array}{c} x_1\\ x_2\\ \vdots\\ x_n\\
\end{array}\right]
\end{displaymath}

A probability statement about this vector is a joint statement about all elements of the vector.

Calculating cumulative bivariate normal probabilities

The most used multivariate normal calculation is the bivariate case, where we let $x$ and $y$ be bivariate normally distributed, each with mean 0 and variance 1, and assume the two variables have correlation of $\rho$. By the definition of correlation $\rho\in[-1,1]$. The cumulative probability distribution

\begin{eqnarray*}
P(x<a, y<b)&=& N(a,b,\rho)\\
& =& \int_{-\infty}^a\int_{-\in...
...t(-\frac{1}{2}\frac{x^2-2\rho xy+y^2}{1-\rho^2} \right)
dx dy
\end{eqnarray*}


There are several approximations to this integral. We pick one such, discussed in (Hull, 1993, Ch 10), shown in code A.3


\begin{program}
% latex2html id marker 4928\caption{Approximation to the cumul...
...e{/home/bernt/2003_algor/all_cc_tex_files/cum_normal_bivariate.cc}
\end{program}

If one has more than two correlated variables, the calculation of cumulative probabilites is a nontrivial problem. One common method involves Monte Carlo estimation of the definite integral. We will consider this, but then it is necessary to first consider simulation of random normal variables.


Simulating random normal numbers

Generation of random numbers is a large topic and is treated at length in such sources as Knuth (1997). The generated numbers can never be truly random, only ``pseudo''-random, they will be generated according to some reproducible algorithm and after a (large) number of random number generations the sequence will start repeating itself. The number of iterations before replication starts is a measure of the quality of a random number generator. For anybody requiring high-quality random number generators the rand() function provided by the standard C ++ library should be avoided, but for not getting into involved discussion of random number generations we use this function as a basis for the generation of uniformly distributed numbers in the interval $[0,1)$, as shown in code A.4.


\begin{program}
% latex2html id marker 4938\caption{Pseudorandom numbers from ...
...indfile{/home/bernt/2003_algor/all_cc_tex_files/random_uniform.cc}
\end{program}

These uniformly distributed distributed random variates are used as a basis for the Polar method for normal densities discussed in Knuth (1997) and inplemented as shown in code A.5


\begin{program}
% latex2html id marker 4943\caption{Pseudorandom numbers from ...
...rindfile{/home/bernt/2003_algor/all_cc_tex_files/random_normal.cc}
\end{program}

Cumulative probabilities for general multivariate distributions

When moving beyond

References

Tong (1990) discusses the multivariate normal distribution, and is a good reference.

Exercises


\begin{Exercise}
Replace the \texttt{random\_uniform} function here by an alter...
...erator from such places as \texttt{mathlib} or \texttt{statlib}.
\end{Exercise}

2003-10-22