Skip to content
p.mba

Type to search tools, guides, glossary terms, frameworks, formula sheets and pages.

Menu

Statistics Toolkit

Hypothesis tests, confidence intervals, sample-size and power planning, regression-output interpretation and a normal/t/chi-square/F calculator.

When you’ll use this
  • Statistics core, weeks 3-5: check one- and two-sample t-test homework, including Welch vs pooled
  • Statistics core, weeks 5-6: proportion and chi-square problems (survey shares, contingency tables)
  • Statistics core, weeks 7-10: read regression output, including log-log elasticities and dummy variables
  • Marketing analytics: size an A/B test and judge whether a lift in conversion is significant
  • Exam prep: replace printed z, t, chi-square and F tables with exact critical values and p-values
  • Summer internship or consulting project: sanity-check a survey margin of error before fielding it

Statistics Toolkit tool

Loading your saved inputs…

Back up all tools

Choose a test
Compare two independent means without assuming equal variances.
Common choices: 0.10, 0.05, 0.01.
Alternative hypothesis H₁
Data
Summary statistics for two independent groups. H₀: μ₁ − μ₂ equals the hypothesized difference.
Usually 0.
Have raw data? Paste it to fill the summary statistics

Decision at α = 0.05

Do not reject H₀

Two-sided p-value 0.0720 is above α

Test statistic (t)

1.822

df = 82.79

p-value (two-sided)

0.0720

Effect size: Cohen's d

0.392

Conventionally small

95% CI for difference in means x̄₁ − x̄₂

-0.32 to 7.32

Estimate 3.5

H₀
μ₁ − μ₂ = 0
H₁
μ₁ − μ₂ ≠ 0

What this means

  • At α = 0.05, do not reject H₀: the data are not significant evidence that the difference in population means (group 1 − group 2) is different from 0 (t(82.8) = 1.82, p = 0.072). That is not proof that it equals 0; the sample may be too small to detect a real difference.
  • If H₀ were true, a result at least this extreme would occur with probability 0.0720.
  • Effect size: Cohen's d = 0.39 (small by Cohen's conventions).
  • 95% confidence interval for μ₁ − μ₂: -0.320 to 7.320.
p-values for each alternative
Alternativep-value
Left-tailed (H₁: less)0.9640
Right-tailed (H₁: greater)0.0360
Two-sided (H₁: ≠)0.0720
Test details
ItemValue
Test statistic t1.8225
Degrees of freedom82.79
Standard error1.92048
Difference in means x̄₁ − x̄₂3.5
Value under H₀0
Lower critical value at α = 0.05-1.989
Upper critical value at α = 0.051.989
95% confidence interval-0.3199 to 7.3199
Pooled standard deviation sp8.92663
Hedges' g (small-sample corrected d)0.38853
Pooled df (for comparison)83
Where the t statistic falls under H₀Density of the t distribution with 82.79 df, with the observed statistic and the critical value(s) marked.
Density0.000.100.200.300.40-3.0-2.0-1.00.01.02.03.0tCritical -1.989Critical 1.989t = 1.822
Data table
Where the t statistic falls under H₀: data
tDensity under H₀
-3.20.00
-3.10.00
-3.00.00
-3.00.01
-2.90.01
-2.80.01
-2.70.01
-2.60.01
-2.60.02
-2.50.02
-2.40.02
-2.30.03
-2.20.03
-2.20.04
-2.10.05
-2.00.06
-1.90.06
-1.80.07
-1.80.09
-1.70.10
-1.60.11
-1.50.13
-1.40.14
-1.40.16
-1.30.18
-1.20.19
-1.10.21
-1.00.23
-1.00.25
-0.90.27
-0.80.29
-0.70.31
-0.60.32
-0.60.34
-0.50.35
-0.40.37
-0.30.38
-0.20.39
-0.20.39
-0.10.40
0.00.40
0.10.40
0.20.39
0.20.39
0.30.38
0.40.37
0.50.35
0.60.34
0.60.32
0.70.31
0.80.29
0.90.27
1.00.25
1.00.23
1.10.21
1.20.19
1.30.18
1.40.16
1.40.14
1.50.13
1.60.11
1.70.10
1.80.09
1.80.07
1.90.06
2.00.06
2.10.05
2.20.04
2.20.03
2.30.03
2.40.02
2.50.02
2.60.02
2.60.01
2.70.01
2.80.01
2.90.01
3.00.01
3.00.00
3.10.00
3.20.00

How this works

This toolkit has five tabs: hypothesis tests, confidence intervals, sample-size and power planning, a regression-output interpreter, and a distribution calculator. Each one runs on summary statistics you type in (means, standard deviations, counts) or on raw data you paste. Everything is computed in your browser. The special functions (normal CDF, incomplete beta and gamma, and their inverses) are implemented from scratch and tested against spreadsheet values to at least nine decimal places.

Formulas

One-sample tests. With sample mean xˉ\bar x, standard deviation ss (or known σ\sigma), size nn and benchmark μ0\mu_0:

z=xˉ−μ0σ/nt=xˉ−μ0s/n,  df=n−1z = \frac{\bar x - \mu_0}{\sigma/\sqrt{n}} \qquad t = \frac{\bar x - \mu_0}{s/\sqrt{n}},\ \ df = n-1

Two independent samples. Welch’s version does not assume equal variances. The pooled version does:

tWelch=(xˉ1−xˉ2)−Δ0s12/n1+s22/n2df=(s12/n1+s22/n2)2(s12/n1)2n1−1+(s22/n2)2n2−1t_{\text{Welch}} = \frac{(\bar x_1-\bar x_2)-\Delta_0}{\sqrt{s_1^2/n_1 + s_2^2/n_2}} \qquad df = \frac{\left(s_1^2/n_1 + s_2^2/n_2\right)^2}{\dfrac{(s_1^2/n_1)^2}{n_1-1} + \dfrac{(s_2^2/n_2)^2}{n_2-1}} sp2=(n1−1)s12+(n2−1)s22n1+n2−2tpooled=(xˉ1−xˉ2)−Δ0sp1/n1+1/n2,  df=n1+n2−2s_p^2 = \frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2} \qquad t_{\text{pooled}} = \frac{(\bar x_1-\bar x_2)-\Delta_0}{s_p\sqrt{1/n_1+1/n_2}},\ \ df = n_1+n_2-2

Paired data. Apply the one-sample t test to the differences: t=(dˉ−Δ0)/(sd/n)t = (\bar d - \Delta_0)/(s_d/\sqrt n) with df=n−1df = n-1.

Proportions. Both tests use the standard error under the null:

z=p^−p0p0(1−p0)/nz=p^1−p^2pˉ(1−pˉ)(1/n1+1/n2),  pˉ=x1+x2n1+n2z = \frac{\hat p - p_0}{\sqrt{p_0(1-p_0)/n}} \qquad z = \frac{\hat p_1 - \hat p_2}{\sqrt{\bar p(1-\bar p)\left(1/n_1 + 1/n_2\right)}},\ \ \bar p = \frac{x_1+x_2}{n_1+n_2}

Chi-square. Goodness-of-fit uses df=k−1−mdf = k - 1 - m, where mm is the number of parameters estimated from the data. Independence uses Eij=RiCj/NE_{ij} = R_i C_j / N and df=(r−1)(c−1)df = (r-1)(c-1):

χ2=∑(O−E)2E\chi^2 = \sum \frac{(O-E)^2}{E}

p-values. The left tail is P(T≤t)P(T \le t) and the right tail is P(T≥t)P(T \ge t). The two-sided p-value is twice the smaller of the two, capped at 1. Chi-square tests are right-tailed.

Effect sizes.

  • Cohen’s d is (xˉ−μ0)/s(\bar x - \mu_0)/s for one sample and (xˉ1−xˉ2)/sp(\bar x_1 - \bar x_2)/s_p for two. For paired data it is dz=dˉ/sdd_z = \bar d / s_d.
  • Cohen’s h is 2arcsin⁡p1−2arcsin⁡p22\arcsin\sqrt{p_1} - 2\arcsin\sqrt{p_2}.
  • Cohen’s w is χ2/N\sqrt{\chi^2/N}.
  • Cramér’s V is χ2/(N(min⁡(r,c)−1))\sqrt{\chi^2/(N(\min(r,c)-1))}.

Confidence intervals. For a mean, use xˉ±t∗s/n\bar x \pm t^{*} s/\sqrt n, or z∗z^{*} when σ is known. For a difference in means, use the same SE and df as the matching test. For a proportion the tool gives two intervals. The Wald interval is p^±z∗p^(1−p^)/n\hat p \pm z^{*}\sqrt{\hat p(1-\hat p)/n}. The Wilson score interval is:

p^+z22n1+z2n ± z1+z2np^(1−p^)n+z24n2\frac{\hat p + \frac{z^2}{2n}}{1+\frac{z^2}{n}} \ \pm\ \frac{z}{1+\frac{z^2}{n}}\sqrt{\frac{\hat p(1-\hat p)}{n} + \frac{z^2}{4n^2}}

Sample size (rounded up):

nmean=(zα/2 σE)2nprop=zα/22 p(1−p)E2nper group=2((zα+zβ) σδ)2n_{\text{mean}} = \left(\frac{z_{\alpha/2}\,\sigma}{E}\right)^2 \qquad n_{\text{prop}} = \frac{z_{\alpha/2}^2\,p(1-p)}{E^2} \qquad n_{\text{per group}} = 2\left(\frac{(z_{\alpha}+z_{\beta})\,\sigma}{\delta}\right)^2 nper group=(zα2pˉqˉ+zβp1q1+p2q2)2(p1−p2)2n_{\text{per group}} = \frac{\left(z_{\alpha}\sqrt{2\bar p\bar q} + z_{\beta}\sqrt{p_1q_1+p_2q_2}\right)^2}{(p_1-p_2)^2}

Here zαz_\alpha means zα/2z_{\alpha/2} for a two-sided design, and zβ=Φ−1(power)z_\beta = \Phi^{-1}(\text{power}). A one-mean design drops the factor of 2.

Regression. Each coefficient gets t=b/SEt = b/SE with df=n−k−1df = n-k-1 and an interval b±t∗ SEb \pm t^{*}\,SE. The model as a whole gets:

Rˉ2=1−(1−R2)n−1n−k−1F=R2/k(1−R2)/(n−k−1)∼Fk, n−k−1\bar R^2 = 1 - (1-R^2)\frac{n-1}{n-k-1} \qquad F = \frac{R^2/k}{(1-R^2)/(n-k-1)} \sim F_{k,\,n-k-1}

Special functions. The building blocks are:

  • the normal CDF from the incomplete gamma: Φ(z)=12erfc⁡(−z/2)\Phi(z) = \tfrac12 \operatorname{erfc}(-z/\sqrt2)
  • the t tail: P(T>t)=12Iν/(ν+t2)(ν/2,1/2)P(T \gt t) = \tfrac12 I_{\nu/(\nu+t^2)}(\nu/2, 1/2)
  • chi-square: P(χ2≤x)=P(k/2,x/2)P(\chi^2 \le x) = P(k/2, x/2)
  • F: P(F≤x)=Id1x/(d1x+d2)(d1/2,d2/2)P(F \le x) = I_{d_1x/(d_1x+d_2)}(d_1/2, d_2/2)

Conventions & assumptions

  • Probabilities are decimals. Enter α = 0.05, not 5. Confidence levels work the same way (0.95).
  • Decision rule. Reject H₀ when p ≤ α. “Do not reject” never means H₀ is proven.
  • Standard deviations use the n − 1 divisor (Excel’s STDEV.S). In the one-sample z test, the value you enter is the known population σ.
  • Two-sample direction. The difference is always group 1 minus group 2, and Δ₀ is the hypothesized value of that difference (usually 0).
  • One-sided tests. The confidence bound shown is one-sided too, at level 1 − α, so it always agrees with the decision.
  • Welch is the default for two independent means. Use pooled only when you have good reason to believe the population variances are equal. The tool warns you when one SD is more than twice the other.
  • Proportion tests use the normal approximation. The tool warns you when expected successes or failures are small.
  • Chi-square tests use no continuity (Yates) correction, which is the same as Excel’s CHISQ.TEST. Expected shares in goodness-of-fit are rescaled to the observed total, so you can enter them as proportions or as counts.
  • Effect-size labels follow Cohen’s conventions: 0.2, 0.5 and 0.8 for d and h, and 0.1, 0.3 and 0.5 for w. The thresholds for V are those for w divided by √(min(r, c) − 1). These are rules of thumb. What counts as a meaningful effect depends on the business context.
  • Sample-size formulas use the normal (z) approximation. The exact t-based answer is usually one to three observations larger for small studies. Power calculations count both rejection tails in a two-sided design.
  • Regression. k counts slope predictors and excludes the intercept. Coefficient p-values are two-sided. Log means the natural log. With ln(Y) and a predictor X, a one-unit change in X shifts Y by about 100·b percent; the exact figure is 100(eᵇ − 1). With ln(Y) and ln(X), b is an elasticity: a 1% change in X shifts Y by about b%, exactly 100(1.01ᵇ − 1)%. With Y and ln(X), a 1% change in X shifts Y by about b/100 units. For a 0/1 dummy, “one unit” means switching from 0 to 1.
  • Non-integer degrees of freedom (as in Welch) are used exactly. Excel’s T.DIST family truncates df to a whole number, so its results differ slightly.
  • Accuracy. Inverses are found by bracketing and bisection, down to a few units in the last floating-point place. They report whether they converged. Above 10 million df, t is treated as standard normal.

Worked example

The tool opens with one example per tab.

Example: Hypothesis test: does a new checkout layout raise average basket size?

A store tests a new layout (group 1) against the old one (group 2). The alternative is two-sided and α = 0.05.

  • Group 1: mean 52.4, SD 8.1, n = 40.
  • Group 2: mean 48.9, SD 9.6, n = 45.

The tool runs a Welch t test:

  • The squared standard error is 8.1²/40 + 9.6²/45 = 1.64025 + 2.048 = 3.68825, so SE = 1.9205.
  • t = (52.4 − 48.9) / 1.9205 = 1.822.
  • The Welch df is 3.68825² / (1.64025²/39 + 2.048²/44) = 82.79.

The two-sided p-value is 0.072, which is above 0.05, so do not reject H₀. The 95% interval for the difference uses t* = 1.989 and runs from −0.32 to 7.32. It includes 0.

The pooled SD is √79.685 = 8.927, so Cohen’s d = 3.5 / 8.927 = 0.39 (small). The lift may be real, but this sample cannot separate it from noise.

Example: Confidence interval: 46 of 120 surveyed students would pay

p̂ = 46/120 = 0.3833, and at 95% z* = 1.96.

  • Wald: 0.3833 ± 0.0870 gives 0.2963 to 0.4703.
  • Wilson: the centre shifts toward one half, to 0.3870, with a half-width of 0.0857. That gives 0.3012 to 0.4727.

With 46 successes and 74 failures the two intervals are close. They drift apart as the counts get small.

Example: Sample size: compare two means

The goal is to detect a 5-point difference when σ = 12, at α = 0.05 (two-sided) with 80% power.

n = 2 × ((1.95996 + 0.84162) × 12/5)² = 2 × 45.2095 = 90.42. Round up to 91 per group, or 182 in total. At 91 per group the power is 80.25%.

Example: Regression: ln(weekly units sold) on ln(ad spend) and a promotion dummy

The model has n = 60 and k = 2, so df = 57 and t* = 2.0025.

TermbSEtp95% CI
Intercept2.100.356.001.4 × 10⁻⁷1.40 to 2.80
ln(ad spend)0.420.094.671.9 × 10⁻⁵0.24 to 0.60
Promotion week (0/1)0.150.053.000.0040.05 to 0.25
  • Ad spend. The ad-spend coefficient is an elasticity: 1% more ad spend goes with about 0.42% more units (exactly 1.01^0.42 − 1 = 0.419%).
  • Promotion weeks. These sell about 15% more, and the exact figure is e^0.15 − 1 = 16.18%.
  • Intercept. The intercept implies about e^2.1 ≈ 8.17 units when ln(ad spend) is 0. That point is outside the data and has no business meaning.

R² = 0.48 and adjusted R² = 1 − 0.52 × 59/57 = 0.462. Overall F = (0.48/2)/(0.52/57) = 26.31 on (2, 57) df, with a p-value of about 8 × 10⁻⁹.

Example: Distribution calculator: t with 24 df at x = 2.1

  • P(T ≤ 2.1) = 0.97679.
  • The right tail is 0.02321.
  • The two-tailed probability is 0.04642.

Going the other way, a two-tailed area of 0.05 leaves 0.025 in each tail, which gives the critical values ±2.0639.

Limitations

  • Summary statistics only for the means tests. The tool cannot check normality, outliers or independence for you. Paste raw data and look at it before trusting a t test with a small sample.
  • No exact tests. For small counts, Fisher’s exact test or an exact binomial test is more reliable than the z and chi-square approximations shown here.
  • No multiple-comparison adjustment. If you run many tests, some will come out “significant” by chance.
  • Sample-size results depend entirely on your planning values for σ, p and the effect size. They assume simple random samples, with no clustering and no attrition.
  • The regression interpreter takes coefficients and standard errors as given. It does not know whether they are robust or clustered, and it cannot detect omitted variables, multicollinearity or heteroskedasticity. The overall F assumes the usual (non-robust) OLS setup. Interpretation sentences describe associations, not causal effects.
  • Statistical significance is not practical significance. Always read the effect size and the confidence interval together with the p-value.

Excel/Sheets equivalents

QuantityExcel / Google Sheets
Normal CDF / inverseNORM.S.DIST(z, TRUE), NORM.S.INV(p), NORM.DIST(x, mean, sd, TRUE), NORM.INV(p, mean, sd)
t tails / inverseT.DIST(t, df, TRUE), T.DIST.RT(t, df), T.DIST.2T(abs(t), df), T.INV(p, df), T.INV.2T(alpha, df)
Chi-squareCHISQ.DIST(x, df, TRUE), CHISQ.DIST.RT(x, df), CHISQ.INV.RT(p, df), CHISQ.TEST(observed, expected)
FF.DIST(x, d1, d2, TRUE), F.DIST.RT(x, d1, d2), F.INV.RT(p, d1, d2)
t tests on raw dataT.TEST(r1, r2, tails, type), where type 1 = paired, 2 = pooled and 3 = Welch
z test on raw dataZ.TEST(range, mu0, sigma) (one-sided, upper tail)
CI margin for a meanCONFIDENCE.T(alpha, sd, n), CONFIDENCE.NORM(alpha, sigma, n)
Summary statisticsAVERAGE, STDEV.S, MEDIAN, COUNT
Regression outputLINEST(y, x, TRUE, TRUE) (Excel’s Analysis ToolPak also prints a full table)
Error functionERF(x), ERFC(x)

Excel’s T.DIST, T.INV and CHISQ functions truncate a fractional df, so to reproduce a Welch p-value exactly, use software that accepts fractional degrees of freedom. See also the decision-tree tool and the core curriculum guide.

Runs entirely in your browser; inputs are saved only on this device. Last updated .