From: Ben Pfaff Date: Tue, 16 May 2023 02:06:56 +0000 (-0700) Subject: T-TEST: Allow duplicate variable names in pairs list. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ae29ab25fdacc70a8c30b3c7f6dce8c2be7e047;p=pspp T-TEST: Allow duplicate variable names in pairs list. "a a b WITH b c c (PAIRED)" makes sense and indicates pairs (a,b), (a,c), and (b,c). Thanks to the anonymous reporter. Bug #64093. --- diff --git a/src/language/commands/t-test-parser.c b/src/language/commands/t-test-parser.c index 3b201e0b5c..88eaca450a 100644 --- a/src/language/commands/t-test-parser.c +++ b/src/language/commands/t-test-parser.c @@ -158,17 +158,15 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds) lex_match (lexer, T_EQUALS); int vars_start = lex_ofs (lexer); - if (!parse_variables_const (lexer, dict, - &v1, &n_v1, - PV_NO_DUPLICATE | PV_NUMERIC)) + if (!parse_variables_const (lexer, dict, &v1, &n_v1, + PV_DUPLICATE | PV_NUMERIC)) goto exit; if (lex_match (lexer, T_WITH)) { with = true; - if (!parse_variables_const (lexer, dict, - &v2, &n_v2, - PV_NO_DUPLICATE | PV_NUMERIC)) + if (!parse_variables_const (lexer, dict, &v2, &n_v2, + PV_DUPLICATE | PV_NUMERIC)) goto exit; int vars_end = lex_ofs (lexer) - 1; diff --git a/tests/language/commands/t-test.at b/tests/language/commands/t-test.at index 706b57a093..5352c6ba9c 100644 --- a/tests/language/commands/t-test.at +++ b/tests/language/commands/t-test.at @@ -56,6 +56,58 @@ Pair 1,A - B,-2.00,.94,.42,-3.16,-.84,-4.78,4,.009 AT_CLEANUP +AT_SETUP([T-TEST /PAIRS with duplicate variables in list]) + +AT_DATA([ref.sps], [dnl +data list list /id * a * b * c * d *. +begin data. +1 2.0 3.0 4.0 4.0 +2 1.0 2.0 5.1 3.9 +3 2.0 4.5 5.2 3.8 +4 2.0 4.5 5.3 3.7 +56 3.0 6.0 5.9 3.6 +end data. + +t-test /PAIRS a c a with b d c (PAIRED). +]) + +AT_DATA([expout], [dnl +Table: Reading free-form data from INLINE. +Variable,Format +id,F8.0 +a,F8.0 +b,F8.0 +c,F8.0 +d,F8.0 + +Table: Paired Sample Statistics +,,N,Mean,Std. Deviation,S.E. Mean +Pair 1,a,5,2.00,.71,.32 +,b,5,4.00,1.54,.69 +Pair 2,c,5,5.10,.69,.31 +,d,5,3.80,.16,.07 +Pair 3,a,5,2.00,.71,.32 +,c,5,5.10,.69,.31 + +Table: Paired Samples Correlations +,,N,Correlation,Sig. +Pair 1,a & b,5,.918,.028 +Pair 2,c & d,5,-.918,.028 +Pair 3,a & c,5,.410,.493 + +Table: Paired Samples Test +,,Paired Differences,,,,,t,df,Sig. (2-tailed) +,,Mean,Std. Deviation,S.E. Mean,95% Confidence Interval of the Difference,,,, +,,,,,Lower,Upper,,, +Pair 1,a - b,-2.00,.94,.42,-3.16,-.84,-4.78,4,.009 +Pair 2,c - d,1.30,.84,.37,.26,2.34,3.47,4,.025 +Pair 3,a - c,-3.10,.76,.34,-4.04,-2.16,-9.14,4,.001 +]) + +AT_CHECK([pspp -o ref.csv ref.sps]) +AT_CHECK([cat ref.csv], [0], [expout]) +AT_CLEANUP + AT_SETUP([T-TEST /PAIRS with per-analysis missing values]) AT_DATA([ref.sps], [dnl