+ df = ttp0->n + ttp1->n - 2.0 ;
+ tab_float (self->t, 5, i*2+3, TAB_RIGHT, df, 2, 0);
+
+ pooled_variance = ( (ttp0->n )*sqr(ttp0->s_std_dev)
+ +
+ (ttp1->n )*sqr(ttp1->s_std_dev)
+ ) / df ;
+
+ t = (ttp0->mean - ttp1->mean) / sqrt(pooled_variance) ;
+ t /= sqrt((ttp0->n + ttp1->n)/(ttp0->n*ttp1->n));
+
+ tab_float (self->t, 4, i*2+3, TAB_RIGHT, t, 8, 3);
+
+
+ which=1; /* get p & q from t & df */
+ cdft(&which, &p, &q, &t, &df, &status, &bound);
+ if ( 0 != status )
+ {
+ msg( SE, _("Error calculating T statistic (cdft returned %d)."),status);
+ }
+
+ tab_float(self->t, 6, i*2+3, TAB_RIGHT, 2.0*(t>0?q:p) , 8, 3);
+
+ mean_diff = ttp0->mean - ttp1->mean;
+ tab_float(self->t, 7, i*2+3, TAB_RIGHT, mean_diff, 8, 3);
+
+
+ std_err_diff = sqrt( sqr(ttp0->se_mean) + sqr(ttp1->se_mean));
+ tab_float(self->t, 8, i*2+3, TAB_RIGHT, std_err_diff, 8, 3);
+
+
+ /* Now work out the confidence interval */
+ q = (1 - cmd->criteria)/2.0; /* 2-tailed test */
+ p = 1 - q ;
+ which=2; /* Calc T from p,q and df */
+ cdft(&which, &p, &q, &t, &df, &status, &bound);
+ if ( 0 != status )
+ {
+ msg( SE, _("Error calculating T statistic (cdft returned %d)."),status);
+ }
+
+ tab_float(self->t, 9, i*2+3, TAB_RIGHT,
+ mean_diff - t * std_err_diff, 8, 3);
+
+ tab_float(self->t, 10, i*2+3, TAB_RIGHT,
+ mean_diff + t * std_err_diff, 8, 3);
+
+
+ {
+ double se2;
+ /* Now for the \sigma_1 != \sigma_2 case */