X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Ft-test.q;h=a483bd9e35f2dea56afd12eb16ab6905725120aa;hb=7c08a6e1009cf60847e770a77a73c650e9326379;hp=d02cdb28d21597a087f51640762de88573c33a3b;hpb=b5c82cc9aabe7e641011130240ae1b2e84348e23;p=pspp-builds.git diff --git a/src/language/stats/t-test.q b/src/language/stats/t-test.q index d02cdb28..a483bd9e 100644 --- a/src/language/stats/t-test.q +++ b/src/language/stats/t-test.q @@ -43,10 +43,12 @@ #include #include #include +#include #include #include #include +#include "minmax.h" #include "xalloc.h" #include "xmemdup0.h" @@ -475,13 +477,13 @@ static void ssbox_base_init (struct ssbox *this, int cols, int rows) { this->finalize = ssbox_base_finalize; - this->t = tab_create (cols, rows, 0); + this->t = tab_create (cols, rows); - tab_columns (this->t, SOM_COL_DOWN, 1); + 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); + tab_dim (this->t, tab_natural_dimensions, NULL, NULL); } /* ssbox implementations. */ @@ -506,7 +508,7 @@ ssbox_one_sample_init (struct ssbox *this, struct t_test_proc *proc) 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 */ @@ -526,7 +528,7 @@ ssbox_independent_samples_init (struct ssbox *this, struct t_test_proc *proc) 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 */ @@ -625,7 +627,7 @@ ssbox_paired_init (struct ssbox *this, struct t_test_proc *proc) 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 */ @@ -1067,11 +1069,11 @@ trbox_base_init (struct trbox *self, size_t data_rows, int cols) const size_t rows = 3 + data_rows; self->finalize = trbox_base_finalize; - self->t = tab_create (cols, rows, 0); + self->t = tab_create (cols, rows); 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); + tab_dim (self->t, tab_natural_dimensions, NULL, NULL); } /* Base finalizer for the trbox */ @@ -1091,14 +1093,14 @@ pscbox (struct t_test_proc *proc) struct tab_table *table; - table = tab_create (cols, rows, 0); + table = tab_create (cols, rows); - tab_columns (table, SOM_COL_DOWN, 1); + 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); + tab_dim (table, tab_natural_dimensions, NULL, NULL); tab_title (table, _("Paired Samples Correlations")); /* column headings */ @@ -1109,10 +1111,6 @@ pscbox (struct t_test_proc *proc) for (i = 0; i < proc->n_pairs; i++) { struct pair *pair = &proc->pairs[i]; - double p, q; - double df = pair->n -2; - double correlation_t = (pair->correlation * sqrt (df) / - sqrt (1 - pow2 (pair->correlation))); /* row headings */ tab_text_format (table, 0, i + 1, TAB_LEFT | TAT_TITLE, @@ -1126,10 +1124,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);