T-TEST: Fixed a bug in reporting the independent samples std err of the difference
[pspp] / src / language / stats / t-test-indep.c
index 115885d4b9750a661dba7d1f7ef33b9cd885f920..ca2c95d58fde7345a7aeb453d05d92aa412a20df 100644 (file)
@@ -334,7 +334,7 @@ indep_test (const struct tt *tt, const struct pair_stats *ps)
     tab_double (t, 6, v * 2 + heading_rows, TAB_RIGHT, 2.0 * (tval > 0 ? q : p),   NULL);
     tab_double (t, 7, v * 2 + heading_rows, TAB_RIGHT, mean_diff, NULL);
 
-    std_err_diff = sqrt ((sigma0 / cc0) + (sigma1 / cc1));
+    std_err_diff = sqrt (pooled_variance * (1.0/cc0 + 1.0/cc1));
     tab_double (t, 8, v * 2 + heading_rows, TAB_RIGHT, std_err_diff, NULL);
 
 
@@ -347,6 +347,7 @@ indep_test (const struct tt *tt, const struct pair_stats *ps)
 
     /* Equal variances not assumed */
     tab_text (t, 1, v * 2 + heading_rows + 1,  TAB_LEFT, _("Equal variances not assumed"));
+    std_err_diff = sqrt ((sigma0 / cc0) + (sigma1 / cc1));
 
     se2 = sigma0 / cc0 + sigma1 / cc1;
     tval = mean_diff / sqrt (se2);