TTest Algorithm

Performed on a set of non-negative numbers and labels of size N. There must be two specific labels. Label 1 must be 1 and label 2 must be 2. There can also be any other labels that will be ignored.

T value

  1. Find the number and sum of each group.
    • Na: number of values in group 1
    • Nb: number of values in group 2
    • Sa: $\sum X_i$
    • Sb: $\sum Y_i$
    • SSa: $\sum {X_i}^2$
    • SSb: $\sum {Y_i}^2$
  2. Compute the sample mean of each group.
    • Ma: $\frac{Sa}{Na}$
    • Mb: $\frac{Sb}{Nb}$
  3. Compute the variance for each group.
  4. Estimate the variance
    • varA: $SSa - \frac{Sa^2}{Na}$
    • varB: $SSb - \frac{Sb^2}{Nb}$
    • Var: $\frac{varA + varB}{Na + Nb - 2}$
  5. Estimate the standard deviation (stDev): $\sqrt{\frac{Var}{Na} + \frac{Var}{Nb}}$
  6. t: $\frac{Ma - Mb}{stDev}$

T probability

  • P-value: $2 * (1 - probt(|t|, Na + Nb - 2))$

-- WillGray - 23 Jul 2004
Edit | Attach | Print version | History: r7 | r4 < r3 < r2 < r1 | Backlinks | View wiki text | Edit WikiText | More topic actions...
Topic revision: r3 - 23 Jul 2004, WillGray
 

This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback