From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p3FLsdX1030872 for ; Fri, 15 Apr 2011 23:54:39 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuYBAJ69qE3RVaE2kGdsb2JhbACeUwGHLggUAQEBAQkJDQcUBCGIb6AmkwOIbYVuBIF+i3qHQYIYOg X-IronPort-AV: E=Sophos;i="4.64,221,1301868000"; d="scan'208";a="105888640" Received: from mail-fx0-f54.google.com ([209.85.161.54]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 15 Apr 2011 23:54:33 +0200 Received: by fxm11 with SMTP id 11so4296222fxm.27 for ; Fri, 15 Apr 2011 14:54:33 -0700 (PDT) Received: by 10.223.73.133 with SMTP id q5mr2622751faj.127.1302904473264; Fri, 15 Apr 2011 14:54:33 -0700 (PDT) MIME-Version: 1.0 Sender: mlin@mlin.net Received: by 10.223.143.65 with HTTP; Fri, 15 Apr 2011 14:54:12 -0700 (PDT) X-Originating-IP: [128.30.109.126] In-Reply-To: <4DA8207F.50207@univ-savoie.fr> References: <1302799455.8429.1240.camel@thinkpad> <4DA80E52.8040404@uv.es> <4DA8207F.50207@univ-savoie.fr> From: Mike Lin Date: Fri, 15 Apr 2011 17:54:12 -0400 X-Google-Sender-Auth: dtgd0fK0F30wMtiQpHAObS5ZpFk Message-ID: To: Christophe Raffalli Cc: caml-list@inria.fr, miguel.pignatelli@uv.es Content-Type: multipart/alternative; boundary=0015174c1ab84e225404a0fc1604 Subject: Re: [Caml-list] Gaussian probability --0015174c1ab84e225404a0fc1604 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This is one implementation for the normal CDF, in terms of the error function provided in ocamlgsl: let normal_cdf ~mu ~sigma x =3D (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 wro= te: > Le 15/04/11 11:22, Miguel Pignatelli a =E9crit : > > 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 wa= nd > 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 th= at > 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 > (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 > > --0015174c1ab84e225404a0fc1604 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable This is one implementation for the normal CDF, in terms of the error functi= on provided in ocamlgsl:

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

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

On Fri, Apr 15, 2011 at 6:39 A= M, Christophe Raffalli <craff73@gmail.com> wrote:
=20=20 =20=20=20=20 =20=20
Le 15/04/11 11:22, Miguel Pignatelli a =E9crit=A0:
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


--0015174c1ab84e225404a0fc1604--