X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fnpar.c;h=409369edbf52ac4c143ee3f1f6896ee0849d52bf;hb=f5f0b6da1e66e087a45152ee74c3aeab60612cf7;hp=97cb7c7bf1c750a171edfcb4fa7f51d0c5a549d4;hpb=8d8d3ba512d7986d79f1edfdac409ad1c039bcc9;p=pspp diff --git a/src/language/stats/npar.c b/src/language/stats/npar.c index 97cb7c7bf1..409369edbf 100644 --- a/src/language/stats/npar.c +++ b/src/language/stats/npar.c @@ -56,12 +56,6 @@ enum missing_type MISS_LISTWISE, }; -enum - { - NPAR_INCLUDE, - NPAR_EXCLUDE - }; - /* Array indices for STATISTICS subcommand. */ enum { @@ -74,28 +68,20 @@ enum /* NPAR TESTS structure. */ struct cmd_npar_tests { - /* CHISQUARE subcommand. */ + /* Count variables indicating how many + of the subcommands have been given. */ int chisquare; - - /* BINOMIAL subcommand. */ int binomial; - - /* WILCOXON subcommand. */ int wilcoxon; - - /* SIGN subcommand. */ int sign; - - /* MISSING subcommand. */ int missing; - long miss; - long incl; - - /* METHOD subcommand. */ int method; - - /* STATISTICS subcommand. */ int statistics; + + /* How missing values should be treated */ + long miss; + + /* Which statistics have been requested */ int a_statistics[NPAR_ST_count]; }; @@ -141,7 +127,6 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests npt->sign = 0; npt->missing = 0; npt->miss = MISS_ANALYSIS; - npt->incl = NPAR_EXCLUDE; npt->method = 0; npt->statistics = 0; memset (npt->a_statistics, 0, sizeof npt->a_statistics); @@ -231,9 +216,9 @@ parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests else if (lex_match_hyphenated_word (lexer, "LISTWISE")) npt->miss = MISS_LISTWISE; else if (lex_match_hyphenated_word (lexer, "INCLUDE")) - npt->incl = NPAR_INCLUDE; + nps->filter = MV_SYSTEM; else if (lex_match_hyphenated_word (lexer, "EXCLUDE")) - npt->incl = NPAR_EXCLUDE; + nps->filter = MV_ANY; else { lex_error (lexer, NULL); @@ -370,6 +355,7 @@ cmd_npar_tests (struct lexer *lexer, struct dataset *ds) struct casereader *input, *group; npar_specs.pool = pool_create (); + npar_specs.filter = MV_ANY; var_hash = const_hsh_create_pool (npar_specs.pool, 0, compare_vars_by_name, hash_var_by_name, @@ -417,8 +403,6 @@ cmd_npar_tests (struct lexer *lexer, struct dataset *ds) } } - npar_specs.filter = cmd.incl == NPAR_EXCLUDE ? MV_ANY : MV_SYSTEM; - input = proc_open (ds); if ( cmd.miss == MISS_LISTWISE ) { @@ -735,6 +719,7 @@ parse_two_sample_related_test (struct lexer *lexer, return true; } + static int npar_wilcoxon (struct lexer *lexer, struct dataset *ds, @@ -781,25 +766,27 @@ npar_sign (struct lexer *lexer, struct dataset *ds, return 1; } + /* Insert the variables for TEST into VAR_HASH */ static void one_sample_insert_variables (const struct npar_test *test, struct const_hsh_table *var_hash) { int i; - struct one_sample_test *ost = UP_CAST (test, struct one_sample_test, parent); + const struct one_sample_test *ost = UP_CAST (test, const struct one_sample_test, parent); for ( i = 0 ; i < ost->n_vars ; ++i ) const_hsh_insert (var_hash, ost->vars[i]); } + static void two_sample_insert_variables (const struct npar_test *test, struct const_hsh_table *var_hash) { int i; - const struct two_sample_test *tst = (const struct two_sample_test *) test; + const struct two_sample_test *tst = UP_CAST (test, const struct two_sample_test, parent); for ( i = 0 ; i < tst->n_pairs ; ++i ) {