X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fwilcoxon.c;h=310206c0e7bf88961e820c05f97831f8568da5a6;hb=9e9ae654181e7f0cb71946db5a0bd95c9a70a689;hp=c0329f6c01e5277e33304377d7ed07c56f99dca5;hpb=9e0e4996fad6563f0a1ce628b80db5c23ef8279e;p=pspp-builds.git diff --git a/src/language/stats/wilcoxon.c b/src/language/stats/wilcoxon.c index c0329f6c..310206c0 100644 --- a/src/language/stats/wilcoxon.c +++ b/src/language/stats/wilcoxon.c @@ -17,23 +17,33 @@ #include + #include "wilcoxon.h" -#include + +#include +#include +#include +#include + #include #include +#include +#include +#include #include -#include +#include +#include +#include #include -#include -#include -#include -#include +#include +#include #include -#include -#include +#include #include -#include -#include +#include + +#include "minmax.h" +#include "xalloc.h" static double append_difference (const struct ccase *c, casenumber n UNUSED, void *aux) @@ -78,11 +88,18 @@ wilcoxon_execute (const struct dataset *ds, struct wilcoxon_state *ws = xcalloc (sizeof (*ws), t2s->n_pairs); const struct variable *weight = dict_get_weight (dict); - struct variable *weightx = var_create_internal (WEIGHT_IDX); + struct variable *weightx = var_create_internal (WEIGHT_IDX, 0); + struct caseproto *proto; input = casereader_create_filter_weight (input, dict, &warn, NULL); + proto = caseproto_create (); + proto = caseproto_add_width (proto, 0); + proto = caseproto_add_width (proto, 0); + if (weight != NULL) + proto = caseproto_add_width (proto, 0); + for (i = 0 ; i < t2s->n_pairs; ++i ) { struct casereader *r = casereader_clone (input); @@ -91,22 +108,20 @@ wilcoxon_execute (const struct dataset *ds, struct subcase ordering; variable_pair *vp = &t2s->pairs[i]; - const int reader_width = weight ? 3 : 2; - - ws[i].sign = var_create_internal (0); - ws[i].absdiff = var_create_internal (1); + ws[i].sign = var_create_internal (0, 0); + ws[i].absdiff = var_create_internal (1, 0); r = casereader_create_filter_missing (r, *vp, 2, exclude, NULL, NULL); subcase_init_var (&ordering, ws[i].absdiff, SC_ASCEND); - writer = sort_create_writer (&ordering, reader_width); + writer = sort_create_writer (&ordering, proto); subcase_destroy (&ordering); for (; (c = casereader_read (r)) != NULL; case_unref (c)) { - struct ccase *output = case_create (reader_width); + struct ccase *output = case_create (proto); double d = append_difference (c, 0, vp); if (d > 0) @@ -140,6 +155,7 @@ wilcoxon_execute (const struct dataset *ds, casereader_destroy (r); ws[i].reader = casewriter_make_reader (writer); } + caseproto_unref (proto); for (i = 0 ; i < t2s->n_pairs; ++i ) { @@ -211,7 +227,7 @@ show_ranks_box (const struct wilcoxon_state *ws, struct tab_table *table = tab_create (5, 1 + 4 * t2s->n_pairs, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Ranks")); @@ -292,7 +308,7 @@ show_tests_box (const struct wilcoxon_state *ws, size_t i; struct tab_table *table = tab_create (1 + t2s->n_pairs, exact ? 5 : 3, 0); - tab_dim (table, tab_natural_dimensions); + tab_dim (table, tab_natural_dimensions, NULL); tab_title (table, _("Test Statistics")); @@ -308,12 +324,12 @@ show_tests_box (const struct wilcoxon_state *ws, tab_text (table, 0, 1, TAB_LEFT, _("Z")); - tab_text (table, 0, 2, TAB_LEFT, _("Asymp. Sig (2-tailed)")); + tab_text (table, 0, 2, TAB_LEFT, _("Asymp. Sig. (2-tailed)")); if ( exact ) { - tab_text (table, 0, 3, TAB_LEFT, _("Exact Sig (2-tailed)")); - tab_text (table, 0, 4, TAB_LEFT, _("Exact Sig (1-tailed)")); + tab_text (table, 0, 3, TAB_LEFT, _("Exact Sig. (2-tailed)")); + tab_text (table, 0, 4, TAB_LEFT, _("Exact Sig. (1-tailed)")); #if 0 tab_text (table, 0, 5, TAB_LEFT, _("Point Probability"));