14 #define LOG_SQRT_PI 0.5723649429247000870717135
17 #define I_SQRT_PI 0.5641895835477562869480795
38 static double poz(
double z) {
50 x = ((((((((0.000124818987 * w - 0.001075204047) * w +
67 x = (((((((((((((-0.000045255659 * y + 0.000152529290) * y -
95 return z > 0.0 ? ((x + 1.0) * 0.5) : ((1.0 - x) * 0.5);
109 if (x <= 0.0 || df < 1)
return 1.0;
112 bool even = !(df & 1);
117 double s = (even ? y : (2.0 *
poz(-std::sqrt(x))));
119 x = 0.5 * (df - 1.0);
120 double z = (even ? 1.0 : 0.5);
123 double c = std::log(a);
126 s += std::exp(c * z - a - e);
131 double e = (even ? 1.0 : (
I_SQRT_PI / std::sqrt(a)));
149 double CHI_EPSILON = 0.000001;
150 double CHI_MAX = 99999.0;
151 double minchisq = 0.0;
152 double maxchisq = CHI_MAX;
160 chisqval = df / std::sqrt(p);
161 while ((maxchisq - minchisq) > CHI_EPSILON) {
167 chisqval = (maxchisq + minchisq) * 0.5;
Package of methods to compute Chi2 related stuff.
static double pochisq(double x, int df)
Probability of chi-square value.
static double critchi(double p, int df)
Compute critical chi-square value toproduce given p.
static double poz(double z)
Probability of normal z value.
static double EXP_MAX_A_VALUE()
Value above which exp(EXP_MAX_A_VALUE) diverges.
__host__ __device__ int2 abs(int2 v)