1 /* PSPP - a program for statistical analysis. -*-c-*-
2 Copyright (C) 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #include <language/stats/npar.h>
20 #include "npar-summary.h"
27 #include <data/case.h>
28 #include <data/casegrouper.h>
29 #include <data/casereader.h>
30 #include <data/dictionary.h>
31 #include <data/procedure.h>
32 #include <data/settings.h>
33 #include <data/variable.h>
34 #include <libpspp/array.h>
35 #include <libpspp/assertion.h>
36 #include <libpspp/cast.h>
37 #include <libpspp/hmapx.h>
38 #include <libpspp/hash-functions.h>
39 #include <libpspp/message.h>
40 #include <libpspp/pool.h>
41 #include <libpspp/str.h>
42 #include <libpspp/taint.h>
43 #include <language/command.h>
44 #include <language/lexer/lexer.h>
45 #include <language/lexer/variable-parser.h>
46 #include <language/lexer/value-parser.h>
47 #include <language/stats/binomial.h>
48 #include <language/stats/chisquare.h>
49 #include <language/stats/runs.h>
50 #include <language/stats/friedman.h>
51 #include <language/stats/kruskal-wallis.h>
52 #include <language/stats/mann-whitney.h>
53 #include <language/stats/wilcoxon.h>
54 #include <language/stats/sign.h>
55 #include <math/moments.h>
58 #define _(msgid) gettext (msgid)
60 /* Settings for subcommand specifiers. */
67 /* Array indices for STATISTICS subcommand. */
70 NPAR_ST_DESCRIPTIVES = 0,
71 NPAR_ST_QUARTILES = 1,
76 /* NPAR TESTS structure. */
79 /* Count variables indicating how many
80 of the subcommands have been given. */
93 /* How missing values should be treated */
96 /* Which statistics have been requested */
97 int a_statistics[NPAR_ST_count];
104 struct npar_test **test;
107 const struct variable **vv; /* Compendium of all variables
108 (those mentioned on ANY subcommand */
109 int n_vars; /* Number of variables in vv */
111 enum mv_class filter; /* Missing values to filter. */
113 bool descriptives; /* Descriptive statistics should be calculated */
114 bool quartiles; /* Quartiles should be calculated */
116 bool exact; /* Whether exact calculations have been requested */
117 double timer; /* Maximum time (in minutes) to wait for exact calculations */
121 /* Prototype for custom subcommands of NPAR TESTS. */
122 static int npar_chisquare (struct lexer *, struct dataset *, struct npar_specs *);
123 static int npar_binomial (struct lexer *, struct dataset *, struct npar_specs *);
124 static int npar_runs (struct lexer *, struct dataset *, struct npar_specs *);
125 static int npar_friedman (struct lexer *, struct dataset *, struct npar_specs *);
126 static int npar_wilcoxon (struct lexer *, struct dataset *, struct npar_specs *);
127 static int npar_sign (struct lexer *, struct dataset *, struct npar_specs *);
128 static int npar_kruskal_wallis (struct lexer *, struct dataset *, struct npar_specs *);
129 static int npar_mann_whitney (struct lexer *, struct dataset *, struct npar_specs *);
130 static int npar_method (struct lexer *, struct npar_specs *);
132 /* Command parsing functions. */
133 static int parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests *p,
134 struct npar_specs *npar_specs );
137 parse_npar_tests (struct lexer *lexer, struct dataset *ds, struct cmd_npar_tests *npt,
138 struct npar_specs *nps)
143 npt->kruskal_wallis = 0;
144 npt->mann_whitney = 0;
149 npt->miss = MISS_ANALYSIS;
152 memset (npt->a_statistics, 0, sizeof npt->a_statistics);
155 if (lex_match_hyphenated_word (lexer, "FRIEDMAN"))
158 switch (npar_friedman (lexer, ds, nps))
165 lex_error (lexer, NULL);
171 else if (lex_match_hyphenated_word (lexer, "RUNS"))
174 switch (npar_runs (lexer, ds, nps))
181 lex_error (lexer, NULL);
187 else if (lex_match_hyphenated_word (lexer, "CHISQUARE"))
189 lex_match (lexer, '=');
191 switch (npar_chisquare (lexer, ds, nps))
198 lex_error (lexer, NULL);
204 else if (lex_match_hyphenated_word (lexer, "BINOMIAL"))
206 lex_match (lexer, '=');
208 switch (npar_binomial (lexer, ds, nps))
215 lex_error (lexer, NULL);
221 else if (lex_match_hyphenated_word (lexer, "K-W") ||
222 lex_match_hyphenated_word (lexer, "KRUSKAL-WALLIS"))
224 lex_match (lexer, '=');
225 npt->kruskal_wallis++;
226 switch (npar_kruskal_wallis (lexer, ds, nps))
233 lex_error (lexer, NULL);
239 else if (lex_match_hyphenated_word (lexer, "M-W") ||
240 lex_match_hyphenated_word (lexer, "MANN-WHITNEY"))
242 lex_match (lexer, '=');
244 switch (npar_mann_whitney (lexer, ds, nps))
251 lex_error (lexer, NULL);
257 else if (lex_match_hyphenated_word (lexer, "WILCOXON"))
259 lex_match (lexer, '=');
261 switch (npar_wilcoxon (lexer, ds, nps))
268 lex_error (lexer, NULL);
274 else if (lex_match_hyphenated_word (lexer, "SIGN"))
276 lex_match (lexer, '=');
278 switch (npar_sign (lexer, ds, nps))
285 lex_error (lexer, NULL);
291 else if (lex_match_hyphenated_word (lexer, "MISSING"))
293 lex_match (lexer, '=');
295 if (npt->missing > 1)
297 msg (SE, _("The %s subcommand may be given only once."), "MISSING");
300 while (lex_token (lexer) != '/' && lex_token (lexer) != '.')
302 if (lex_match_hyphenated_word (lexer, "ANALYSIS"))
303 npt->miss = MISS_ANALYSIS;
304 else if (lex_match_hyphenated_word (lexer, "LISTWISE"))
305 npt->miss = MISS_LISTWISE;
306 else if (lex_match_hyphenated_word (lexer, "INCLUDE"))
307 nps->filter = MV_SYSTEM;
308 else if (lex_match_hyphenated_word (lexer, "EXCLUDE"))
309 nps->filter = MV_ANY;
312 lex_error (lexer, NULL);
315 lex_match (lexer, ',');
318 else if (lex_match_hyphenated_word (lexer, "METHOD"))
320 lex_match (lexer, '=');
324 msg (SE, _("The %s subcommand may be given only once."), "METHOD");
327 switch (npar_method (lexer, nps))
334 lex_error (lexer, NULL);
340 else if (lex_match_hyphenated_word (lexer, "STATISTICS"))
342 lex_match (lexer, '=');
344 while (lex_token (lexer) != '/' && lex_token (lexer) != '.')
346 if (lex_match_hyphenated_word (lexer, "DESCRIPTIVES"))
347 npt->a_statistics[NPAR_ST_DESCRIPTIVES] = 1;
348 else if (lex_match_hyphenated_word (lexer, "QUARTILES"))
349 npt->a_statistics[NPAR_ST_QUARTILES] = 1;
350 else if (lex_match (lexer, T_ALL))
351 npt->a_statistics[NPAR_ST_ALL] = 1;
354 lex_error (lexer, NULL);
357 lex_match (lexer, ',');
360 else if ( settings_get_syntax () != COMPATIBLE && lex_match_id (lexer, "ALGORITHM"))
362 lex_match (lexer, '=');
363 if (lex_match_id (lexer, "COMPATIBLE"))
364 settings_set_cmd_algorithm (COMPATIBLE);
365 else if (lex_match_id (lexer, "ENHANCED"))
366 settings_set_cmd_algorithm (ENHANCED);
368 if (!lex_match (lexer, '/'))
372 if (lex_token (lexer) != '.')
374 lex_error (lexer, _("expecting end of command"));
385 static void one_sample_insert_variables (const struct npar_test *test,
388 static void two_sample_insert_variables (const struct npar_test *test,
391 static void n_sample_insert_variables (const struct npar_test *test,
395 npar_execute (struct casereader *input,
396 const struct npar_specs *specs,
397 const struct dataset *ds)
400 struct descriptives *summary_descriptives = NULL;
402 for ( t = 0 ; t < specs->n_tests; ++t )
404 const struct npar_test *test = specs->test[t];
405 if ( NULL == test->execute )
407 msg (SW, _("NPAR subcommand not currently implemented."));
410 test->execute (ds, casereader_clone (input), specs->filter, test, specs->exact, specs->timer);
413 if ( specs->descriptives )
415 summary_descriptives = xnmalloc (sizeof (*summary_descriptives),
418 npar_summary_calc_descriptives (summary_descriptives,
419 casereader_clone (input),
421 specs->vv, specs->n_vars,
425 if ( (specs->descriptives || specs->quartiles)
426 && !taint_has_tainted_successor (casereader_get_taint (input)) )
427 do_summary_box (summary_descriptives, specs->vv, specs->n_vars );
429 free (summary_descriptives);
430 casereader_destroy (input);
434 cmd_npar_tests (struct lexer *lexer, struct dataset *ds)
436 struct cmd_npar_tests cmd;
439 struct npar_specs npar_specs = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
440 struct casegrouper *grouper;
441 struct casereader *input, *group;
442 struct hmapx var_map = HMAPX_INITIALIZER (var_map);
445 npar_specs.pool = pool_create ();
446 npar_specs.filter = MV_ANY;
447 npar_specs.n_vars = -1;
448 npar_specs.vv = NULL;
450 if ( ! parse_npar_tests (lexer, ds, &cmd, &npar_specs) )
452 pool_destroy (npar_specs.pool);
456 for (i = 0; i < npar_specs.n_tests; ++i )
458 const struct npar_test *test = npar_specs.test[i];
459 test->insert_variables (test, &var_map);
463 struct hmapx_node *node;
464 struct variable *var;
465 npar_specs.n_vars = 0;
467 HMAPX_FOR_EACH (var, node, &var_map)
469 npar_specs.n_vars ++;
470 npar_specs.vv = pool_nrealloc (npar_specs.pool, npar_specs.vv, npar_specs.n_vars, sizeof (*npar_specs.vv));
471 npar_specs.vv[npar_specs.n_vars - 1] = var;
475 sort (npar_specs.vv, npar_specs.n_vars, sizeof (*npar_specs.vv),
476 compare_var_ptrs_by_name, NULL);
478 if ( cmd.statistics )
482 for ( i = 0 ; i < NPAR_ST_count; ++i )
484 if ( cmd.a_statistics[i] )
488 case NPAR_ST_DESCRIPTIVES:
489 npar_specs.descriptives = true;
491 case NPAR_ST_QUARTILES:
492 npar_specs.quartiles = true;
495 npar_specs.quartiles = true;
496 npar_specs.descriptives = true;
505 input = proc_open (ds);
506 if ( cmd.miss == MISS_LISTWISE )
508 input = casereader_create_filter_missing (input,
516 grouper = casegrouper_create_splits (input, dataset_dict (ds));
517 while (casegrouper_get_next_group (grouper, &group))
518 npar_execute (group, &npar_specs, ds);
519 ok = casegrouper_destroy (grouper);
520 ok = proc_commit (ds) && ok;
522 pool_destroy (npar_specs.pool);
523 hmapx_destroy (&var_map);
525 return ok ? CMD_SUCCESS : CMD_CASCADING_FAILURE;
529 npar_runs (struct lexer *lexer, struct dataset *ds,
530 struct npar_specs *specs)
532 struct runs_test *rt = pool_alloc (specs->pool, sizeof (*rt));
533 struct one_sample_test *tp = &rt->parent;
534 struct npar_test *nt = &tp->parent;
536 nt->execute = runs_execute;
537 nt->insert_variables = one_sample_insert_variables;
539 if ( lex_force_match (lexer, '(') )
541 if ( lex_match_id (lexer, "MEAN"))
543 rt->cp_mode = CP_MEAN;
545 else if (lex_match_id (lexer, "MEDIAN"))
547 rt->cp_mode = CP_MEDIAN;
549 else if (lex_match_id (lexer, "MODE"))
551 rt->cp_mode = CP_MODE;
553 else if (lex_is_number (lexer))
555 rt->cutpoint = lex_number (lexer);
556 rt->cp_mode = CP_CUSTOM;
561 lex_error (lexer, _("Expecting MEAN, MEDIAN, MODE or number"));
565 lex_force_match (lexer, ')');
566 lex_force_match (lexer, '=');
567 if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
568 &tp->vars, &tp->n_vars,
569 PV_NO_SCRATCH | PV_NO_DUPLICATE | PV_NUMERIC))
576 specs->test = pool_realloc (specs->pool,
578 sizeof (*specs->test) * specs->n_tests);
580 specs->test[specs->n_tests - 1] = nt;
586 npar_friedman (struct lexer *lexer, struct dataset *ds,
587 struct npar_specs *specs)
589 struct one_sample_test *ft = pool_alloc (specs->pool, sizeof (*ft));
590 struct npar_test *nt = &ft->parent;
592 nt->execute = friedman_execute;
593 nt->insert_variables = one_sample_insert_variables;
595 lex_match (lexer, '=');
597 if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
598 &ft->vars, &ft->n_vars,
599 PV_NO_SCRATCH | PV_NO_DUPLICATE | PV_NUMERIC))
605 specs->test = pool_realloc (specs->pool,
607 sizeof (*specs->test) * specs->n_tests);
609 specs->test[specs->n_tests - 1] = nt;
616 npar_chisquare (struct lexer *lexer, struct dataset *ds,
617 struct npar_specs *specs)
619 struct chisquare_test *cstp = pool_alloc (specs->pool, sizeof (*cstp));
620 struct one_sample_test *tp = &cstp->parent;
621 struct npar_test *nt = &tp->parent;
624 nt->execute = chisquare_execute;
625 nt->insert_variables = one_sample_insert_variables;
627 if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
628 &tp->vars, &tp->n_vars,
629 PV_NO_SCRATCH | PV_NO_DUPLICATE))
634 cstp->ranged = false;
636 if ( lex_match (lexer, '('))
639 if ( ! lex_force_num (lexer)) return 0;
640 cstp->lo = lex_integer (lexer);
642 lex_force_match (lexer, ',');
643 if (! lex_force_num (lexer) ) return 0;
644 cstp->hi = lex_integer (lexer);
645 if ( cstp->lo >= cstp->hi )
648 _("The specified value of HI (%d) is "
649 "lower than the specified value of LO (%d)"),
654 if (! lex_force_match (lexer, ')')) return 0;
657 cstp->n_expected = 0;
658 cstp->expected = NULL;
659 if ( lex_match (lexer, '/') )
661 if ( lex_match_id (lexer, "EXPECTED") )
663 lex_force_match (lexer, '=');
664 if ( ! lex_match_id (lexer, "EQUAL") )
668 while ( lex_is_number (lexer) )
672 f = lex_number (lexer);
674 if ( lex_match (lexer, '*'))
677 f = lex_number (lexer);
680 lex_match (lexer, ',');
682 cstp->n_expected += n;
683 cstp->expected = pool_realloc (specs->pool,
687 for ( i = cstp->n_expected - n ;
688 i < cstp->n_expected;
690 cstp->expected[i] = f;
696 lex_put_back (lexer, '/');
699 if ( cstp->ranged && cstp->n_expected > 0 &&
700 cstp->n_expected != cstp->hi - cstp->lo + 1 )
703 _("%d expected values were given, but the specified "
704 "range (%d-%d) requires exactly %d values."),
705 cstp->n_expected, cstp->lo, cstp->hi,
706 cstp->hi - cstp->lo +1);
711 specs->test = pool_realloc (specs->pool,
713 sizeof (*specs->test) * specs->n_tests);
715 specs->test[specs->n_tests - 1] = nt;
722 npar_binomial (struct lexer *lexer, struct dataset *ds,
723 struct npar_specs *specs)
725 struct binomial_test *btp = pool_alloc (specs->pool, sizeof (*btp));
726 struct one_sample_test *tp = &btp->parent;
727 struct npar_test *nt = &tp->parent;
729 nt->execute = binomial_execute;
730 nt->insert_variables = one_sample_insert_variables;
732 btp->category1 = btp->category2 = btp->cutpoint = SYSMIS;
736 if ( lex_match (lexer, '(') )
738 if ( lex_force_num (lexer) )
740 btp->p = lex_number (lexer);
742 lex_force_match (lexer, ')');
748 /* Kludge: q2c swallows the '=' so put it back here */
749 lex_put_back (lexer, '=');
751 if (lex_match (lexer, '=') )
753 if (parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds),
754 &tp->vars, &tp->n_vars,
755 PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
757 if (lex_match (lexer, '('))
759 lex_force_num (lexer);
760 btp->category1 = lex_number (lexer);
762 if ( lex_match (lexer, ','))
764 if ( ! lex_force_num (lexer) ) return 2;
765 btp->category2 = lex_number (lexer);
770 btp->cutpoint = btp->category1;
773 lex_force_match (lexer, ')');
782 specs->test = pool_realloc (specs->pool,
784 sizeof (*specs->test) * specs->n_tests);
786 specs->test[specs->n_tests - 1] = nt;
793 parse_two_sample_related_test (struct lexer *lexer,
794 const struct dictionary *dict,
795 struct two_sample_test *test_parameters,
801 parse_two_sample_related_test (struct lexer *lexer,
802 const struct dictionary *dict,
803 struct two_sample_test *test_parameters,
810 const struct variable **vlist1;
813 const struct variable **vlist2;
816 test_parameters->parent.insert_variables = two_sample_insert_variables;
818 if (!parse_variables_const_pool (lexer, pool,
821 PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
824 if ( lex_match (lexer, T_WITH))
827 if ( !parse_variables_const_pool (lexer, pool, dict,
829 PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
832 paired = (lex_match (lexer, '(') &&
833 lex_match_id (lexer, "PAIRED") && lex_match (lexer, ')'));
841 if ( n_vlist1 != n_vlist2)
842 msg (SE, _("PAIRED was specified but the number of variables "
843 "preceding WITH (%zu) did not match the number "
844 "following (%zu)."), n_vlist1, n_vlist2);
846 test_parameters->n_pairs = n_vlist1 ;
850 test_parameters->n_pairs = n_vlist1 * n_vlist2;
855 test_parameters->n_pairs = (n_vlist1 * (n_vlist1 - 1)) / 2 ;
858 test_parameters->pairs =
859 pool_alloc (pool, sizeof ( variable_pair) * test_parameters->n_pairs);
866 assert (n_vlist1 == n_vlist2);
867 for ( i = 0 ; i < n_vlist1; ++i )
869 test_parameters->pairs[n][1] = vlist1[i];
870 test_parameters->pairs[n][0] = vlist2[i];
877 for ( i = 0 ; i < n_vlist1; ++i )
879 for ( j = 0 ; j < n_vlist2; ++j )
881 test_parameters->pairs[n][1] = vlist1[i];
882 test_parameters->pairs[n][0] = vlist2[j];
891 for ( i = 0 ; i < n_vlist1 - 1; ++i )
893 for ( j = i + 1 ; j < n_vlist1; ++j )
895 assert ( n < test_parameters->n_pairs);
896 test_parameters->pairs[n][1] = vlist1[i];
897 test_parameters->pairs[n][0] = vlist1[j];
903 assert ( n == test_parameters->n_pairs);
910 parse_n_sample_related_test (struct lexer *lexer,
911 const struct dictionary *dict,
912 struct n_sample_test *nst,
916 if (!parse_variables_const_pool (lexer, pool,
918 &nst->vars, &nst->n_vars,
919 PV_NUMERIC | PV_NO_SCRATCH | PV_NO_DUPLICATE) )
922 if ( ! lex_force_match (lexer, T_BY))
925 nst->indep_var = parse_variable_const (lexer, dict);
927 if ( ! lex_force_match (lexer, '('))
930 value_init (&nst->val1, var_get_width (nst->indep_var));
931 if ( ! parse_value (lexer, &nst->val1, var_get_width (nst->indep_var)))
933 value_destroy (&nst->val1, var_get_width (nst->indep_var));
937 lex_match (lexer, ',');
939 value_init (&nst->val2, var_get_width (nst->indep_var));
940 if ( ! parse_value (lexer, &nst->val2, var_get_width (nst->indep_var)))
942 value_destroy (&nst->val2, var_get_width (nst->indep_var));
946 if ( ! lex_force_match (lexer, ')'))
953 npar_wilcoxon (struct lexer *lexer,
955 struct npar_specs *specs )
959 struct two_sample_test *tp = pool_alloc (specs->pool, sizeof (*tp));
960 struct npar_test *nt = &tp->parent;
961 nt->execute = wilcoxon_execute;
963 if (!parse_two_sample_related_test (lexer, dataset_dict (ds),
968 specs->test = pool_realloc (specs->pool,
970 sizeof (*specs->test) * specs->n_tests);
971 specs->test[specs->n_tests - 1] = nt;
978 npar_mann_whitney (struct lexer *lexer,
980 struct npar_specs *specs )
982 struct n_sample_test *tp = pool_alloc (specs->pool, sizeof (*tp));
983 struct npar_test *nt = &tp->parent;
985 nt->insert_variables = n_sample_insert_variables;
986 nt->execute = mann_whitney_execute;
988 if (!parse_n_sample_related_test (lexer, dataset_dict (ds),
993 specs->test = pool_realloc (specs->pool,
995 sizeof (*specs->test) * specs->n_tests);
996 specs->test[specs->n_tests - 1] = nt;
1003 npar_sign (struct lexer *lexer, struct dataset *ds,
1004 struct npar_specs *specs)
1006 struct two_sample_test *tp = pool_alloc (specs->pool, sizeof (*tp));
1007 struct npar_test *nt = &tp->parent;
1009 nt->execute = sign_execute;
1011 if (!parse_two_sample_related_test (lexer, dataset_dict (ds),
1016 specs->test = pool_realloc (specs->pool,
1018 sizeof (*specs->test) * specs->n_tests);
1019 specs->test[specs->n_tests - 1] = nt;
1025 npar_kruskal_wallis (struct lexer *lexer, struct dataset *ds,
1026 struct npar_specs *specs)
1028 struct n_sample_test *tp = pool_alloc (specs->pool, sizeof (*tp));
1029 struct npar_test *nt = &tp->parent;
1031 nt->insert_variables = n_sample_insert_variables;
1033 nt->execute = kruskal_wallis_execute;
1035 if (!parse_n_sample_related_test (lexer, dataset_dict (ds),
1040 specs->test = pool_realloc (specs->pool,
1042 sizeof (*specs->test) * specs->n_tests);
1043 specs->test[specs->n_tests - 1] = nt;
1049 insert_variable_into_map (struct hmapx *var_map, const struct variable *var)
1051 size_t hash = hash_pointer (var, 0);
1052 struct hmapx_node *node;
1053 const struct variable *v = NULL;
1055 HMAPX_FOR_EACH_WITH_HASH (v, node, hash, var_map)
1061 hmapx_insert (var_map, CONST_CAST (struct variable *, var), hash);
1064 /* Insert the variables for TEST into VAR_MAP */
1066 one_sample_insert_variables (const struct npar_test *test,
1067 struct hmapx *var_map)
1070 const struct one_sample_test *ost = UP_CAST (test, const struct one_sample_test, parent);
1072 for ( i = 0 ; i < ost->n_vars ; ++i )
1073 insert_variable_into_map (var_map, ost->vars[i]);
1078 two_sample_insert_variables (const struct npar_test *test,
1079 struct hmapx *var_map)
1082 const struct two_sample_test *tst = UP_CAST (test, const struct two_sample_test, parent);
1084 for ( i = 0 ; i < tst->n_pairs ; ++i )
1086 variable_pair *pair = &tst->pairs[i];
1088 insert_variable_into_map (var_map, (*pair)[0]);
1089 insert_variable_into_map (var_map, (*pair)[1]);
1094 n_sample_insert_variables (const struct npar_test *test,
1095 struct hmapx *var_map)
1098 const struct n_sample_test *tst = UP_CAST (test, const struct n_sample_test, parent);
1100 for ( i = 0 ; i < tst->n_vars ; ++i )
1101 insert_variable_into_map (var_map, tst->vars[i]);
1103 insert_variable_into_map (var_map, tst->indep_var);
1108 npar_method (struct lexer *lexer, struct npar_specs *specs)
1110 if ( lex_match_id (lexer, "EXACT") )
1112 specs->exact = true;
1114 if (lex_match_id (lexer, "TIMER"))
1118 if ( lex_match (lexer, '('))
1120 if ( lex_force_num (lexer) )
1122 specs->timer = lex_number (lexer);
1125 lex_force_match (lexer, ')');