File: libprob.h

package info (click to toggle)
gretl 2016d-1
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 48,620 kB
  • ctags: 22,779
  • sloc: ansic: 345,830; sh: 4,648; makefile: 2,712; xml: 570; perl: 364
file content (164 lines) | stat: -rw-r--r-- 4,347 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#ifndef LIBPROB_H
#define LIBPROB_H

/* cephes error conditions */
enum {
    CEPHES_DOMAIN = 1,  /* argument domain error */
    CEPHES_SING,        /* argument singularity */
    CEPHES_OVERFLOW,    /* overflow range error */
    CEPHES_UNDERFLOW,   /* underflow range error */
    CEPHES_TLOSS,       /* total loss of precision */
    CEPHES_PLOSS,       /* partial loss of precision */
    CEPHES_UNKNOWN      /* unspecified error */
};

/* area under the binomial pdf, from 0 to k, of the
   binomial distribution with success probability p
   and n trials.
*/
double bdtr (int k, int n, double p);

/* area under the binomial pdf, from k+1 to n, of the
   binomial distribution with success probability p
   and n trials. 
*/
double bdtrc (int k, int n, double p);

/* success probability such that the area under the 
   binomial pdf from 0 to k with n trials equals y.
*/
double bdtri (int k, int n, double y);

/* area under the left hand tail (from 0 to x)
   of the Chi square probability density function with
   v degrees of freedom.
*/
double chdtr (double v, double x);

/* area under the right hand tail (from x to infinity)
   of the Chi square probability density function with
   v degrees of freedom.
*/
double chdtrc (double v, double x);

/*
   Finds the Chi-square argument x such that the integral
   from x to infinity of the Chi-square density is equal
   to the given cumulative probability y.
*/
double chdtri (double df, double y);

/*
   Returns the area from 0 to x under the F density
   function (also known as Snedcor's density or the
   variance ratio density).
*/
double fdtr (double a, double b, double x);

/*
   Returns the area from x to infinity under the F density
   function (also known as Snedcor's density or the
   variance ratio density).
*/
double fdtrc (double a, double b, double x);

/*
   Finds the F density argument x such that the integral
   from x to infinity of the F density is equal to the
   given probability p.
*/
double fdtri (double a, double b, double y);

/*
   Computes the integral from minus infinity to t of the Student
   t distribution with k > 0 degrees of freedom.
*/
double stdtr (double rk, double t);

/*
   Given probability p, finds the argument t such that stdtr(k,t)
   is equal to p.
*/
double stdtri (double rk, double p);

/*
   Returns the area under the Gaussian probability density
   function, integrated from minus infinity to x.
*/
double ndtr (double a);

/*
   Returns the argument, x, for which the area under the
   Gaussian probability density function (integrated from
   minus infinity to x) is equal to y.
*/
double ndtri (double y0);

/*
  Returns the sum of the first k terms of the Poisson
  distribution with mean and variance m.
*/
double pdtr (int k, double m);

/*
  Returns the sum of the terms k+1 to infinity of the Poisson
  distribution with mean and variance m.
*/
double pdtrc (int k, double m);

/*
  Finds the Poisson variable x such that the integral
  from 0 to x of the Poisson density is equal to the
  given probability y.  
*/
double pdtri (int k, double y);

/* Returns the integral from zero to x of the gamma pdf
   with XX.
*/
double gdtr (double a, double b, double x);

/* Returns the integral from x to infinity of the gamma
   pdf with XX.
*/
double gdtrc (double a, double b, double x);

/* 
   Returns the inverse incomplete gamma function.
*/
double igami (double a, double y0 );

/*
   Returns gamma function of the argument.  The result is
   correctly signed.
*/
double cephes_gamma (double x); /* cephes' gamma(), renamed */

/*
   Returns the base e (2.718...) logarithm of the absolute
   value of the gamma function of the argument.
   The sign (+1 or -1) of the gamma function is set in a
   global variable named cephes_sgngam.
*/
double cephes_lgamma (double x); /* alias for cephes' lgam() */

/* Returns the current value of cephes_sgngam */
int get_cephes_sgngam (void);

/* Returns incomplete beta integral of the arguments, evaluated
   from zero to x
*/
double incbet (double a, double b, double x);

/* Returns the Psi (digamma) function of the argument */
double psi (double x);

/* Evaluate roots of polynomial */
int polrt (double *xcof, double *cof, int m, cmplx *root);

/* Accessor for cephes error code */
int get_cephes_errno (void);

void set_cephes_hush (int s);

#endif /* LIBPROB_H */