Skip to content

ttestES

Description

ttestES performs a power analysis of a one-sample or two-sample t-test, returning the effect size (in the original units) corresponding to a desired statistical power. The effect size is for two-tailed tests (ie, in either direction).

Syntax

ttestES(s_d, df, [power = 0.8], [alpha = 0.05]) where

  • s_d is the standard deviation of the test statistic
  • df is the degrees of freedom of s_d
  • power is the desired statistical power, defaulting to 0.8 (80%)
  • alpha is the significance level of the test, defaulting to 0.05 (5%)

Example

Twelve students measured the concentration of hydrogen peroxide in an OTC antibiotic formulation. The nominal concentration of the solution (claimed by the manufacturer) is 30 g/L. The question that ttestES answers is: with this experimental design (12 students measuring H2O2 using this specific protocol), what effect size is detectable 80% of the time using this statistical method? The answer is that a deviation of about 0.9 g/L from nominal would be detectable 80% of the time. If that is not sufficient then the experimental design (or the statistical detection method) needs to change.

Twelve H2O2 measurements, their 20% trimmed mean (29.40 g/L) with SE and DOF, and ttestES giving a detectable effect size of 0.89 g/L

Source Code

ttestES = LAMBDA(
    s_d, // std deviation of the (non-studentized) test stat
    df, // degrees of freedom of s_d
    [power], // desired statistical power (default 0.8)
    [alpha], // desired significance level (default 0.05)
    LET(
        power, IF(ISOMITTED(power), 0.8, power),
        alpha, IF(ISOMITTED(alpha), 0.05, alpha),
        tcrit, T.INV.2T(alpha, df),
        (T.INV.2T((1 - power) * 2, df) + tcrit) * s_d
    )
);