This is one implementation for the normal CDF, in terms of the error function provided in ocamlgsl:

let normal_cdf ~mu ~sigma x =
  (1.0 +. Gsl_sf.erf ((x -. mu) /. (sigma *. sqrt 2.0))) /. 2.0

As Christophe mentioned, this CDF gives you the probability that your random variable is at most x (rather than greater than x). GSL and ocamlgsl also provide many other functions related to the normal and other distributions.

On Fri, Apr 15, 2011 at 6:39 AM, Christophe Raffalli <craff73@gmail.com> wrote:
Le 15/04/11 11:22, Miguel Pignatelli a écrit :
Hi all,

Maybe this is a long shot, but...

I have a gaussian (normal) distribution defined by its mean and std deviation and I want to know the probability of a given known point in the curve.
Probability of one point for a continuous law is zero ... You probably wand the
probability Phi(x) of a point in ]-infinity,x] from which you can compute the probability of
a point in any interval ...


I have followed the formula given in [1] but I realized that there are cases where P > 1. After struggling myself for a while I realized that that formula expresses the probability *density* distribution that happens that can be > 1. Are you aware of any module in ocaml to calculate the probability [0<P<1]?

(other kind of relevant references are also welcome)

Thanks in advance,

M;

[1] http://en.wikipedia.org/wiki/Normal_distribution

The same page has a section :

Numerical approximations for the normal CDF

to compute Phi(x) yourself (this is not completely trivial).

Hope this helps,
Christophe