44 |
|
|
45 |
#include "beta_inc.c" |
#include "beta_inc.c" |
46 |
|
|
|
#if 0 |
|
|
/* |
|
|
* First approximation is also found in Abramowitz |
|
|
* and Stegun. This is used only for small values of t |
|
|
* and small degrees of freedom. |
|
|
*/ |
|
|
static double |
|
|
t_small (const double t, const double nu) |
|
|
{ |
|
|
/* Compute beta_inc when t^2 < n. Final result is always a small |
|
|
amount to be added to or subtracted from 0.5 so we only need |
|
|
absolute accuracy of O(DBL_EPS) -- this information could be used |
|
|
to optimise inside beta_inc (currently it isn't) */ |
|
|
|
|
|
double u = (t * t) / nu; |
|
|
double eps = u / (1 + u); |
|
|
double q = beta_inc (0.5, nu / 2.0, eps); |
|
|
|
|
|
return q; |
|
|
} |
|
|
|
|
|
static double |
|
|
t_large (const double t, const double nu) |
|
|
{ |
|
|
/* Compute beta_inc when t^2 > n. Final result may be needed to full |
|
|
relative precision, depending on whether we are computing the |
|
|
upper or lower tail. Again this information could be used to |
|
|
optimise inside beta_inc. */ |
|
|
|
|
|
double v = nu / (t * t); |
|
|
double eps = v / (1 + v); |
|
|
double q = beta_inc (nu / 2.0, 0.5, eps); |
|
|
|
|
|
return q; |
|
|
} |
|
|
|
|
|
#endif |
|
|
|
|
47 |
static double |
static double |
48 |
poly_eval (const double c[], unsigned int n, double x) |
poly_eval (const double c[], unsigned int n, double x) |
49 |
{ |
{ |
129 |
* a point u such that gsl_cdf_gauss(u) = tcdf(t). |
* a point u such that gsl_cdf_gauss(u) = tcdf(t). |
130 |
* Approximate the t cdf with gsl_cdf_gauss. |
* Approximate the t cdf with gsl_cdf_gauss. |
131 |
* |
* |
132 |
* Valid for: |
* Valid for: ???? |
133 |
* |
* |
134 |
*/ |
*/ |
135 |
static double |
static double |