caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mike Lin <mikelin@mit.edu>
To: Christophe Raffalli <craff73@gmail.com>
Cc: caml-list@inria.fr, miguel.pignatelli@uv.es
Subject: Re: [Caml-list] Gaussian probability
Date: Fri, 15 Apr 2011 17:54:12 -0400	[thread overview]
Message-ID: <BANLkTin5MRiC66zJj13TZAT91aKm-tW_-Q@mail.gmail.com> (raw)
In-Reply-To: <4DA8207F.50207@univ-savoie.fr>

[-- Attachment #1: Type: text/plain, Size: 1678 bytes --]

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
>
>

[-- Attachment #2: Type: text/html, Size: 2628 bytes --]

      reply	other threads:[~2011-04-15 21:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-14 16:44 [Caml-list] [ANN] Ocamlnet-3.3.0test1 (multicore, GSS-API) Gerd Stolpmann
2011-04-15  9:22 ` [Caml-list] Gaussian probability Miguel Pignatelli
2011-04-15 10:39   ` Christophe Raffalli
2011-04-15 21:54     ` Mike Lin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BANLkTin5MRiC66zJj13TZAT91aKm-tW_-Q@mail.gmail.com \
    --to=mikelin@mit.edu \
    --cc=caml-list@inria.fr \
    --cc=craff73@gmail.com \
    --cc=miguel.pignatelli@uv.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).