From: John Darrington Date: Sun, 27 Apr 2014 14:21:43 +0000 (+0200) Subject: Fixed a bug where contrasts with negative T where incorrectly processed. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=52d795d2fe3611efc1d51b2cdf6851bb7e67682e Fixed a bug where contrasts with negative T where incorrectly processed. Planned contrasts in the ONEWAY procedure reported p-values > 1 when T was negative. This change fixes this problem. Thanks to Douglas Bonett for reporting this. --- diff --git a/NEWS b/NEWS index 76c0913f88..f44ab7774d 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,11 @@ See the end for copying conditions. Please send PSPP bug reports to bug-gnu-pspp@gnu.org. +Changes from 0.8.2 to 0.8.3.1: + + * Fixed a bug where planned comparisons in oneway anova did not correctly + handle negative T-values. + Changes from 0.8.2 to 0.8.3: * Independent T-Tests displayed the standard error of the difference diff --git a/src/language/stats/oneway.c b/src/language/stats/oneway.c index 807b5dc39f..a64b760eb9 100644 --- a/src/language/stats/oneway.c +++ b/src/language/stats/oneway.c @@ -1528,10 +1528,15 @@ show_contrast_tests (const struct oneway_spec *cmd, const struct oneway_workspac TAB_RIGHT, df, NULL); - /* The Significance */ - tab_double (t, 7, (v * lines_per_variable) + i + 1 + n_contrasts, - TAB_RIGHT, 2 * gsl_cdf_tdist_Q (T,df), - NULL); + { + double p = gsl_cdf_tdist_P (T, df); + double q = gsl_cdf_tdist_Q (T, df); + + /* The Significance */ + tab_double (t, 7, (v * lines_per_variable) + i + 1 + n_contrasts, + TAB_RIGHT, 2 * ((T > 0) ? q : p), + NULL); + } } if ( v > 0 ) diff --git a/tests/language/stats/oneway.at b/tests/language/stats/oneway.at index 16c2b55b9c..03e8145d16 100644 --- a/tests/language/stats/oneway.at +++ b/tests/language/stats/oneway.at @@ -464,15 +464,15 @@ Table: Contrast Tests ,,Contrast,Value of Contrast,Std. Error,t,df,Sig. (2-tailed) x,Assume equal variances,1,-7.40,6.67,1.11,20,.28 ,,2,6.26,12.32,.51,20,.62 -,Does not assume equal,1,-7.40,10.04,-.74,4.53,1.50 +,Does not assume equal,1,-7.40,10.04,-.74,4.53,.50 ,,2,6.26,5.85,1.07,2.87,.37 y,Assume equal variances,1,-6.88,1.16,5.94,20,.00 ,,2,3.50,2.14,1.63,20,.12 -,Does not assume equal,1,-6.88,.91,-7.51,7.00,2.00 +,Does not assume equal,1,-6.88,.91,-7.51,7.00,.00 ,,2,3.50,1.32,2.65,7.00,.03 z,Assume equal variances,1,-9.70,8.07,1.20,20,.24 ,,2,11.73,14.91,.79,20,.44 -,Does not assume equal,1,-9.70,9.57,-1.01,3.64,1.63 +,Does not assume equal,1,-9.70,9.57,-1.01,3.64,.37 ,,2,11.73,14.53,.81,9.88,.44 ]) @@ -883,21 +883,21 @@ Table: Contrast Tests height,Assume equal variances,1,-222.27,20.23,10.99,6,.00 ,,2,-666.80,60.68,10.99,6,.00 ,,3,-2000.40,182.03,10.99,6,.00 -,Does not assume equal,1,-222.27,27.67,-8.03,2.00,1.98 -,,2,-666.80,83.02,-8.03,2.00,1.98 -,,3,-2000.40,249.07,-8.03,2.00,1.98 +,Does not assume equal,1,-222.27,27.67,-8.03,2.00,.02 +,,2,-666.80,83.02,-8.03,2.00,.02 +,,3,-2000.40,249.07,-8.03,2.00,.02 weight,Assume equal variances,1,-36.16,2.74,13.21,6,.00 ,,2,-108.48,8.21,13.21,6,.00 ,,3,-325.44,24.63,13.21,6,.00 -,Does not assume equal,1,-36.16,2.19,-16.48,5.42,2.00 -,,2,-108.48,6.58,-16.48,5.42,2.00 -,,3,-325.44,19.75,-16.48,5.42,2.00 +,Does not assume equal,1,-36.16,2.19,-16.48,5.42,.00 +,,2,-108.48,6.58,-16.48,5.42,.00 +,,3,-325.44,19.75,-16.48,5.42,.00 temperature,Assume equal variances,1,-.98,2.74,.36,6,.73 ,,2,-2.94,8.22,.36,6,.73 ,,3,-8.83,24.67,.36,6,.73 -,Does not assume equal,1,-.98,2.07,-.47,4.19,1.34 -,,2,-2.94,6.22,-.47,4.19,1.34 -,,3,-8.83,18.66,-.47,4.19,1.34 +,Does not assume equal,1,-.98,2.07,-.47,4.19,.66 +,,2,-2.94,6.22,-.47,4.19,.66 +,,3,-8.83,18.66,-.47,4.19,.66 ]) AT_CLEANUP