+ int which =1;
+ double t;
+ double p,q;
+ double df;
+ int status;
+ double bound;
+ struct t_test_proc *ttp;
+ ttp= &cmd->v_variables[i]->p.t_t;
+
+
+ tab_text (trb->t, 0, i+3, TAB_LEFT, cmd->v_variables[i]->name);
+
+ t = (ttp->mean - cmd->n_testval ) * sqrt(ttp->n) / ttp->std_dev ;
+
+ tab_float (trb->t, 1, i+3, TAB_RIGHT, t, 8,3);
+
+ /* degrees of freedom */
+ df = ttp->n - 1;
+
+ tab_float (trb->t, 2, i+3, TAB_RIGHT, df, 8,0);
+
+ cdft(&which, &p, &q, &t, &df, &status, &bound);
+
+ if ( 0 != status )
+ {
+ msg( SE, _("Error calculating T statistic (cdft returned %d)."),status);
+ }
+
+
+ /* Multiply by 2 to get 2-tailed significance */
+ tab_float (trb->t, 3, i+3, TAB_RIGHT, q*2.0, 8,3);
+
+ tab_float (trb->t, 4, i+3, TAB_RIGHT, ttp->mean_diff, 8,3);
+
+
+ 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 (trb->t, 5, i+3, TAB_RIGHT,
+ ttp->mean_diff - t * ttp->se_mean, 8,4);
+
+ tab_float (trb->t, 6, i+3, TAB_RIGHT,
+ ttp->mean_diff + t * ttp->se_mean, 8,4);