t2val(x1,x2 [,df:T or pooled:F]), x1 and x2 REAL vectors or matrices with the same number of columns |

t2val(x1,x2) computes the two-sample Student's t statistic for testing the null hypothesis that the data in REAL vectors x1 and x2 have the same population means mu1 and mu2. The usual pooled estimate of variance is used in computing the standard error of the difference of means. This assumes that the two variances are equal. t2val(x1,x2,df:T) computes a structure with two components, 't' and 'df', containing the t-statistic and its degrees of freedom, respectively. t2val(x1,x2,pooled:F) computes a structure with components 't' and 'df'. 't' contains the t-statistic computed using the unpooled estimate sqrt(s1^2/n1 + s2^2/n2) of the standard error of the difference of means. 'df' contains Satterthwaite's approximate degrees of freedom. A test of H0: mu1 = mu2 based on t and df does not assume the two populations have the same variance. When there are missing values, they are omitted from the computation and an informative message is printed. When the null hypothesis is that mu1 - mu2 is some specific value other than zero, say delta, then t2val(x1-delta,x2) will produce the correct t value for that null hypothesis. For example, if delta is -3, use t2val(x1-(-3),x2 [,df:T or pooled:T]). When x1 and x2 are REAL matrices with ncols(x1) = ncols(x2) = M, t2val() computes two-sample t-statistics for each column separately. t2val(x1,x2) returns a vector of length M. t2val(x1,x2,df:T) and t2val(x1,x2,pooled:F) return a structure with components 't' and 'df', with each component a REAL vector of length M. P values may be computed using the function cumstu() or the macro twotailt(), for example, by Cmd> result <- t2val(x1,x2,df:T);twotailt(result$t,result$df) or Cmd> result <- t2val(x1,x2,pooled:F);twotailt(result$t,result$df) See also topics tval(), tint(), t2int(), cumstu(), and twotailt().

Gary Oehlert 2003-01-15