From: John Darrington Date: Sat, 23 Oct 2010 09:43:06 +0000 (+0200) Subject: Add test for friedman test and fix problem with missing values X-Git-Tag: v0.7.7~188 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96933598f8938a216439e98f6758c8916d85873c;p=pspp-builds.git Add test for friedman test and fix problem with missing values --- diff --git a/src/language/stats/friedman.c b/src/language/stats/friedman.c index 31964852..d5890e3f 100644 --- a/src/language/stats/friedman.c +++ b/src/language/stats/friedman.c @@ -113,6 +113,10 @@ friedman_execute (const struct dataset *ds, } input = casereader_create_filter_weight (input, dict, &warn, NULL); + input = casereader_create_filter_missing (input, + ft->vars, ft->n_vars, + exclude, 0, 0); + for (; (c = casereader_read (input)); case_unref (c)) { double prev_x = SYSMIS; @@ -201,9 +205,6 @@ friedman_execute (const struct dataset *ds, static void show_ranks_box (const struct one_sample_test *ost, const struct friedman *fr) { - const struct variable *weight = dict_get_weight (fr->dict); - const struct fmt_spec *wfmt = weight ? var_get_print_format (weight) : &F_8_0; - int i; const int row_headers = 1; const int column_headers = 1; @@ -234,7 +235,7 @@ show_ranks_box (const struct one_sample_test *ost, const struct friedman *fr) TAB_LEFT, var_to_string (ost->vars[i])); tab_double (table, 1, row_headers + i, - 0, fr->rank_sum[i] / fr->cc, wfmt); + 0, fr->rank_sum[i] / fr->cc, 0); } tab_submit (table); diff --git a/tests/language/stats/npar.at b/tests/language/stats/npar.at index a8888ab9..30dd4fae 100644 --- a/tests/language/stats/npar.at +++ b/tests/language/stats/npar.at @@ -880,3 +880,43 @@ Asymp. Sig. (2-tailed),.0000 ]) AT_CLEANUP + + +AT_SETUP([NPAR TESTS Friedman]) +AT_DATA([npar-friedman.sps], [dnl +set format F15.4. +data list notable list /x * y * z. +begin data +9.5 6.5 8.1 +8.0 6.0 6.0 +7.0 6.5 4.2 +9.5 5.0 7.3 +9.0 7.0 6.2 +8.5 6.9 6.5 +7.5 8.0 6.5 +6.0 8.0 3.1 +5.0 6.0 4.9 +7.5 7.5 6.2 +end data. + +npar tests + /friedman = x y z. +]) + +AT_CHECK([pspp -o pspp.csv npar-friedman.sps]) + +AT_CHECK([cat pspp.csv], [0], [dnl +Table: Ranks +,Mean Rank +x,2.6500 +y,2.1000 +z,1.2500 + +Table: Test Statistics +N,10 +Chi-Square,10.4737 +df,2 +Asymp. Sig.,.0053 +]) + +AT_CLEANUP