tTestMinimumEffect

fun tTestMinimumEffect(n: Int, power: Double = 0.8, alpha: Double = 0.05, alternative: Alternative = Alternative.TWO_SIDED, type: TTestType = TTestType.TWO_SAMPLE): Double(source)

Computes the minimum detectable effect size (MDE) for a t-test at the given sample size.

Returns the smallest Cohen's d that a t-test with n observations can detect at the specified power and alpha. This is useful for assessing whether an existing dataset is large enough to detect practically meaningful effects.

Example:

// Smallest effect detectable with 100 subjects per group
tTestMinimumEffect(n = 100, power = 0.8) // ~0.396
tTestMinimumEffect(n = 100, type = TTestType.ONE_SAMPLE) // ~0.281

Return

the minimum detectable Cohen's d effect size. Always positive.

Parameters

n

the sample size. For TTestType.TWO_SAMPLE, this is the per-group size. For TTestType.ONE_SAMPLE and TTestType.PAIRED, this is the total size or number of pairs. Must be at least 2.

power

the target statistical power. Defaults to 0.8 (80%). Must be in (0, 1).

alpha

the significance level (Type I error rate). Defaults to 0.05 (5%). Must be in (0, 1).

alternative

the direction of the alternative hypothesis. Defaults to Alternative.TWO_SIDED.

type

the t-test design. Defaults to TTestType.TWO_SAMPLE.

See also

to compute power at a given effect size.

to find the sample size needed for a target power.