Standard conventions
$\alpha = 0.05$ (5% significance), Power $= 0.80$ (80%), $\beta = 0.20$. These are defaults — domain knowledge should guide actual choices.
Cloud function endpoint
GET https://us-central1-tukey-multple-comparisons.cloudfunctions.net/t_testOneSample
effect_size — Cohen's d (float, e.g. 0.5)target_power — desired power (float, e.g. 0.8)significance_level — α (float, e.g. 0.05)tail_type — two_tailed | one_tailed
{"required_sample_size": 34}
Implementation note
The calculator uses an iterative binary search with the exact t-distribution (incomplete beta function) rather than the normal approximation — this is especially important for small $n$.
Normal approximation valid when
$np \geq 5$ and $n(1-p) \geq 5$ for both $p$ and $p_0$.
Why Fisher's Z?
The correlation coefficient $r$ has a skewed sampling distribution. Fisher's Z transform maps $r \in (-1,1)$ to a near-normally distributed variable with standard error $\approx 1/\sqrt{n-3}$, enabling straightforward z-test power calculations.
Implementation detail
The calculator uses a binary search over $n$ with the F-distribution critical value from the incomplete beta function. Power is approximated via the normal distribution applied to $\lambda = nkf^2$.
| Test Type | Small | Medium | Large |
|---|---|---|---|
| Cohen's d (t-tests) | 0.2 | 0.5 | 0.8 |
| Cohen's f (ANOVA) | 0.1 | 0.25 | 0.4 |
| Cohen's f² (Regression) | 0.02 | 0.15 | 0.35 |
| R² (Regression) | 0.02 | 0.13 | 0.26 |
| Correlation r | 0.1 | 0.3 | 0.5 |
Important note
These are general guidelines only. Effect sizes should be grounded in practical significance and prior domain knowledge — not chosen to meet Cohen's thresholds.
https://us-central1-tukey-multple-comparisons.cloudfunctions.net/
/t_testOneSample
— Non-central t-distribution (exact)
effect_size | float — Cohen's d |
target_power | float — e.g. 0.8 |
significance_level | float — e.g. 0.05 |
tail_type | two_tailed | one_tailed |
{"required_sample_size": 34}
CORS — serving from file://
If opening this page directly from disk (file://), the browser will block the cloud call. Serve from a local web server: python -m http.server 8000, then open http://localhost:8000/SampleSizeFormulas.html.
Key references
• Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.)
• Faul, F., Erdfelder, E., Lang, A. G., & Buchner, A. (2007). G*Power 3
• Lakens, D. (2013). Calculating and reporting effect sizes
• Murphy, K. R., Myors, B., & Wolach, A. (2014). Statistical Power Analysis