#include <output/table.h>
#include <data/format.h>
+#include "minmax.h"
#include "xalloc.h"
#include "xmemdup0.h"
tab_text (this->t, 1, 0, TAB_CENTER | TAT_TITLE, _("N"));
tab_text (this->t, 2, 0, TAB_CENTER | TAT_TITLE, _("Mean"));
tab_text (this->t, 3, 0, TAB_CENTER | TAT_TITLE, _("Std. Deviation"));
- tab_text (this->t, 4, 0, TAB_CENTER | TAT_TITLE, _("SE. Mean"));
+ tab_text (this->t, 4, 0, TAB_CENTER | TAT_TITLE, _("S.E. Mean"));
}
/* Initialize the independent samples ssbox */
tab_text (this->t, 2, 0, TAB_CENTER | TAT_TITLE, _("N"));
tab_text (this->t, 3, 0, TAB_CENTER | TAT_TITLE, _("Mean"));
tab_text (this->t, 4, 0, TAB_CENTER | TAT_TITLE, _("Std. Deviation"));
- tab_text (this->t, 5, 0, TAB_CENTER | TAT_TITLE, _("SE. Mean"));
+ tab_text (this->t, 5, 0, TAB_CENTER | TAT_TITLE, _("S.E. Mean"));
}
/* Populate the ssbox for independent samples */
tab_text (this->t, 2, 0, TAB_CENTER | TAT_TITLE, _("Mean"));
tab_text (this->t, 3, 0, TAB_CENTER | TAT_TITLE, _("N"));
tab_text (this->t, 4, 0, TAB_CENTER | TAT_TITLE, _("Std. Deviation"));
- tab_text (this->t, 5, 0, TAB_CENTER | TAT_TITLE, _("SE. Mean"));
+ tab_text (this->t, 5, 0, TAB_CENTER | TAT_TITLE, _("S.E. Mean"));
}
/* Populate the ssbox for paired values */
/* Degrees of freedom */
tab_double (trb->t, 8, i + 3, TAB_RIGHT, df, &proc->weight_format);
- p = gsl_cdf_tdist_P (t, df);
- q = gsl_cdf_tdist_P (t, df);
+ p = gsl_cdf_tdist_P (t,df);
+ q = gsl_cdf_tdist_Q (t,df);
tab_double (trb->t, 9, i + 3, TAB_RIGHT, 2.0 * (t > 0 ? q : p), NULL);
}
for (i = 0; i < proc->n_pairs; i++)
{
struct pair *pair = &proc->pairs[i];
+ double df = pair->n - 2;
double p, q;
- double df = pair->n -2;
- double correlation_t = (pair->correlation * sqrt (df) /
- sqrt (1 - pow2 (pair->correlation)));
+
+ /* corr2 will mathematically always be in the range [0, 1.0]. Inaccurate
+ calculations sometimes cause it to be slightly greater than 1.0, so
+ force it into the correct range to avoid NaN from sqrt(). */
+ double corr2 = MIN (1.0, pow2 (pair->correlation));
+ double correlation_t = pair->correlation * sqrt (df) / sqrt (1 - corr2);
/* row headings */
tab_text_format (table, 0, i + 1, TAB_LEFT | TAT_TITLE,