libtpcmodel
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Defines | Functions | Variables
normaldistr.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "include/normaldistr.h"
#include "include/polevl.h"
#include "include/expx2.h"
Include dependency graph for normaldistr.c:

Go to the source code of this file.

Defines

#define USE_EXPXSQ   1
#define UTHRESH   37.519379347

Functions

static double cephes_erfc (double a)
static double erfce (double x)
static double cephes_erf (double x)
double normal_pvalue_2 (double x)
double normal_pvalue_1 (double x)
double ndtr (double a)

Variables

static double P []
static double Q []
static double R []
static double S []
static double T []
static double U []

Define Documentation

#define USE_EXPXSQ   1

Definition at line 213 of file normaldistr.c.

#define UTHRESH   37.519379347

Definition at line 270 of file normaldistr.c.


Function Documentation

static double cephes_erf ( double  x) [static]

Error function

Returns:
Returns erf(x)
Parameters:
xvariable x

Definition at line 389 of file normaldistr.c.

References cephes_erfc(), p1evl(), polevl(), T, and U.

Referenced by cephes_erfc(), and ndtr().

Here is the call graph for this function:

static double cephes_erfc ( double  a) [static]

Complementary error function

Returns:
Returns erfc(a)
Parameters:
avariable a

Definition at line 309 of file normaldistr.c.

References cephes_erf(), expx2(), MAXLOG, P, p1evl(), polevl(), Q, R, and S.

Referenced by cephes_erf(), and ndtr().

Here is the call graph for this function:

static double erfce ( double  x) [static]

Exponentially scaled erfc function exp(x^2) erfc(x) valid for x > 1. Use with ndtr and expx2.

Definition at line 372 of file normaldistr.c.

References P, p1evl(), polevl(), Q, R, and S.

Referenced by ndtr().

Here is the call graph for this function:

double ndtr ( double  a)

Returns the area under the Gaussian probability density function, integrated from minus infinity to a.

Parameters:
avariable a

Definition at line 275 of file normaldistr.c.

References cephes_erf(), cephes_erfc(), erfce(), expx2(), and SQRTH.

Referenced by normal_pvalue_1(), normal_pvalue_2(), and runs_test().

Here is the call graph for this function:

double normal_pvalue_1 ( double  x)

normal_pvalue_1: x: double-precision value.

Calculates the one-sided p-value for x in relation to the standard normal distribution (that is, the probability that a random variable distributed as N(0, 1) is greater than x).

Returns:
Returns 1 minus the value of the standard normal CDF evaluated at x.

Definition at line 51 of file normaldistr.c.

References ndtr().

Referenced by test_normaldistr().

Here is the call graph for this function:

double normal_pvalue_2 ( double  x)

normal_pvalue_2: x: double-precision value.

Calculates the two-sided p-value for x in relation to the standard normal distribution.

Returns:
Returns 2 times (1 minus the value of the standard normal CDF evaluated at abs(x)).

Definition at line 32 of file normaldistr.c.

References ndtr().

Referenced by test_normaldistr().

Here is the call graph for this function:


Variable Documentation

double P[] [static]
Initial value:
 {
    2.46196981473530512524E-10,
    5.64189564831068821977E-1,
    7.46321056442269912687E0,
    4.86371970985681366614E1,
    1.96520832956077098242E2,
    5.26445194995477358631E2,
    9.34528527171957607540E2,
    1.02755188689515710272E3,
    5.57535335369399327526E2
}

Definition at line 215 of file normaldistr.c.

Referenced by cephes_erfc(), and erfce().

double Q[] [static]
Initial value:
 {
    
    1.32281951154744992508E1,
    8.67072140885989742329E1,
    3.54937778887819891062E2,
    9.75708501743205489753E2,
    1.82390916687909736289E3,
    2.24633760818710981792E3,
    1.65666309194161350182E3,
    5.57535340817727675546E2
}

Definition at line 226 of file normaldistr.c.

Referenced by cephes_erfc(), and erfce().

double R[] [static]
Initial value:
 {
    5.64189583547755073984E-1,
    1.27536670759978104416E0,
    5.01905042251180477414E0,
    6.16021097993053585195E0,
    7.40974269950448939160E0,
    2.97886665372100240670E0
}

Definition at line 237 of file normaldistr.c.

Referenced by cephes_erfc(), erfce(), and runs_test().

double S[] [static]
Initial value:
 {
    
    2.26052863220117276590E0,
    9.39603524938001434673E0,
    1.20489539808096656605E1,
    1.70814450747565897222E1,
    9.60896809063285878198E0,
    3.36907645100081516050E0
}

Definition at line 245 of file normaldistr.c.

Referenced by cephes_erfc(), and erfce().

double T[] [static]
Initial value:
 {
    9.60497373987051638749E0,
    9.00260197203842689217E1,
    2.23200534594684319226E3,
    7.00332514112805075473E3,
    5.55923013010394962768E4
}

Definition at line 254 of file normaldistr.c.

Referenced by cephes_erf().

double U[] [static]
Initial value:
 {
    
    3.35617141647503099647E1,
    5.21357949780152679795E2,
    4.59432382970980127987E3,
    2.26290000613890934246E4,
    4.92673942608635921086E4
}

Definition at line 261 of file normaldistr.c.

Referenced by cephes_erf().