double ans, f2, f21, f2lf, ff4, otsum, qsqz, rotsum, t1, twa1, ulen, wprb;
int i, j, jj;
-#ifdef IEEE_754
- abort (! (ISNAN (q) || ISNAN (rr) || ISNAN (cc) || ISNAN (df)));
-#endif
+ assert (! (isnan (q) || isnan (rr) || isnan (cc) || isnan (df)));
if (q <= 0)
return R_DT_0;
static double fmax2(double x, double y)
{
-#ifdef IEEE_754
- if (ISNAN(x) || ISNAN(y))
+ if (isnan(x) || isnan(y))
return x + y;
-#endif
return (x < y) ? y : x;
}
double ans = 0.0, valx0, valx1, x0, x1, xabs;
int iter;
-#ifdef IEEE_754
- if (ISNAN(p) || ISNAN(rr) || ISNAN(cc) || ISNAN(df)) {
- ML_ERROR(ME_DOMAIN, "qtukey");
+ if (isnan(p) || isnan(rr) || isnan(cc) || isnan(df)) {
+ /* ML_ERROR(ME_DOMAIN, "qtukey"); */
return p + rr + cc + df;
}
-#endif
/* df must be > 1 ; there must be at least two values */
- assert (! (df < 2 || rr < 1 || cc < 2) );
+ /* ^^
+ JMD: The comment says 1 but the code says 2.
+ Which is correct?
+ */
+ assert (df >= 2);
+ assert (rr >= 1);
+ assert (cc >= 2);
+
R_Q_P01_boundaries (p, 0, ML_POSINF);
moments1_calculate (mom_i, &n_i, NULL, &var_i, 0, 0);
moments1_calculate (mom_j, &n_j, NULL, &var_j, 0, 0);
+
+ if ( n_i <= 1.0 || n_j <= 1.0)
+ return SYSMIS;
nom = pow2 (var_i/n_i + var_j/n_j);
denom = pow2 (var_i/n_i) / (n_i - 1) + pow2 (var_j/n_j) / (n_j - 1);
static double tukey_pinv (double std_err, double alpha, double df, int k, const struct moments1 *mom_i UNUSED, const struct moments1 *mom_j UNUSED)
{
+ if ( k < 2 || df < 2)
+ return SYSMIS;
+
return std_err / sqrt (2.0) * qtukey (1 - alpha, 1.0, k, df, 1, 0);
}
m = sqrt ((var_i/n_i + var_j/n_j) / 2.0);
+ if ( k < 2 || df < 2)
+ return SYSMIS;
+
return m * qtukey (1 - alpha, 1.0, k, df, 1, 0);
}
int k = pvw->n_groups;
double df = ph->dff (pvw, dd_i->mom, dd_j->mom);
double ts = ph->tsf (k, dd_i->mom, dd_j->mom, std_err);
+ if ( df == SYSMIS)
+ return SYSMIS;
return ph->p1f (ts, k - 1, df);
}
{
int k = pvw->n_groups;
double df = ph->dff (pvw, dd_i->mom, dd_j->mom);
+ if ( df == SYSMIS)
+ return SYSMIS;
return ph->pinv (std_err, cmd->alpha, df, k, dd_i->mom, dd_j->mom);
}
static double tukey_1tailsig (double ts, double df1, double df2)
{
- double twotailedsig = 1.0 - ptukey (ts, 1.0, df1 + 1, df2, 1, 0);
+ double twotailedsig;
+
+ if (df2 < 2 || df1 < 1)
+ return SYSMIS;
+
+ twotailedsig = 1.0 - ptukey (ts, 1.0, df1 + 1, df2, 1, 0);
return twotailedsig / 2.0;
}