From: John Darrington Date: Sun, 17 Oct 2010 14:50:47 +0000 (+0200) Subject: Fix test failures on T-TEST command. X-Git-Tag: v0.7.7~203 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83e8c065e5db30dc0bc84c86743de2bac7c8325c;p=pspp-builds.git Fix test failures on T-TEST command. The t-test command is documented to ignore cases which are not in a valid group. The new levene function does not have any awareness of the group criteria. Therefore we must remove any values which are not in a valid group. --- diff --git a/src/language/stats/t-test.q b/src/language/stats/t-test.q index 77fc4297..9eb2c471 100644 --- a/src/language/stats/t-test.q +++ b/src/language/stats/t-test.q @@ -1401,6 +1401,23 @@ group_calc (const struct dictionary *dict, struct t_test_proc *proc, return 0; } + +static bool +is_criteria_value (const struct ccase *c, void *aux) +{ + const struct t_test_proc *proc = aux; + const union value *val = case_data (c, proc->indep_var); + int width = var_get_width (proc->indep_var); + + if ( value_equal (val, &proc->g_value[0], width)) + return true; + + if ( value_equal (val, &proc->g_value[1], width)) + return true; + + return false; +} + static void calculate (struct t_test_proc *proc, struct casereader *input, const struct dataset *ds) @@ -1410,7 +1427,7 @@ calculate (struct t_test_proc *proc, struct trbox test_results_box; struct taint *taint; struct ccase *c; - + int i; c = casereader_peek (input, 0); if (c == NULL) { @@ -1439,11 +1456,18 @@ calculate (struct t_test_proc *proc, break; case T_IND_SAMPLES: group_calc (dict, proc, casereader_clone (input)); - int i; + for (i = 0; i < proc->n_vars; ++i) { struct group_proc *grp_data = group_proc_get (proc->vars[i]); + if ( proc->criterion == CMP_EQ ) + { + input = casereader_create_filter_func (input, is_criteria_value, NULL, + proc, + NULL); + } + grp_data->levene = levene ( input, proc->indep_var, proc->vars[i], dict_get_weight (dict), proc->exclude); } break;