X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Ft-test.q;h=8aee3b157992827fa9021c876b39822809ab43b2;hb=a9c5233f04317a5ace5e6dcbe3cc61a9f07d57c0;hp=d417d31c0d26e944b9548756e05e2baf1ea178ad;hpb=cb586666724d5fcbdb658ce471b85484f0a7babe;p=pspp-builds.git diff --git a/src/language/stats/t-test.q b/src/language/stats/t-test.q index d417d31c..8aee3b15 100644 --- a/src/language/stats/t-test.q +++ b/src/language/stats/t-test.q @@ -43,8 +43,8 @@ #include #include #include -#include -#include +#include +#include #include #include "minmax.h" @@ -478,11 +478,9 @@ ssbox_base_init (struct ssbox *this, int cols, int rows) this->finalize = ssbox_base_finalize; this->t = tab_create (cols, rows); - tab_columns (this->t, SOM_COL_DOWN); tab_headers (this->t, 0, 0, 1, 0); tab_box (this->t, TAL_2, TAL_2, TAL_0, TAL_1, 0, 0, cols - 1, rows - 1); tab_hline (this->t, TAL_2, 0, cols- 1, 1); - tab_dim (this->t, tab_natural_dimensions, NULL, NULL); } /* ssbox implementations. */ @@ -1072,7 +1070,6 @@ trbox_base_init (struct trbox *self, size_t data_rows, int cols) tab_headers (self->t, 0, 0, 3, 0); tab_box (self->t, TAL_2, TAL_2, TAL_0, TAL_0, 0, 0, cols - 1, rows - 1); tab_hline (self->t, TAL_2, 0, cols- 1, 3); - tab_dim (self->t, tab_natural_dimensions, NULL, NULL); } /* Base finalizer for the trbox */ @@ -1094,12 +1091,10 @@ pscbox (struct t_test_proc *proc) table = tab_create (cols, rows); - tab_columns (table, SOM_COL_DOWN); tab_headers (table, 0, 0, 1, 0); tab_box (table, TAL_2, TAL_2, TAL_0, TAL_1, 0, 0, cols - 1, rows - 1); tab_hline (table, TAL_2, 0, cols - 1, 1); tab_vline (table, TAL_2, 2, 0, rows - 1); - tab_dim (table, tab_natural_dimensions, NULL, NULL); tab_title (table, _("Paired Samples Correlations")); /* column headings */ @@ -1110,14 +1105,6 @@ pscbox (struct t_test_proc *proc) for (i = 0; i < proc->n_pairs; i++) { struct pair *pair = &proc->pairs[i]; - double df = pair->n - 2; - double p, q; - - /* 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, @@ -1131,10 +1118,8 @@ pscbox (struct t_test_proc *proc) tab_double (table, 2, i + 1, TAB_RIGHT, pair->n, &proc->weight_format); tab_double (table, 3, i + 1, TAB_RIGHT, pair->correlation, NULL); - p = gsl_cdf_tdist_P (correlation_t, df); - q = gsl_cdf_tdist_Q (correlation_t, df); - tab_double (table, 4, i + 1, TAB_RIGHT, - 2.0 * (correlation_t > 0 ? q : p), NULL); + tab_double (table, 4, i + 1, TAB_RIGHT, + 2.0 * significance_of_correlation (pair->correlation, pair->n), NULL); } tab_submit (table);