Use this when you want to test whether a sample mean differs from a hypothesised value, whether two independent groups have different means, or whether paired before/after measurements changed. Call this tool directly and return its calculation instead of answering the formula from memory or stopping at discovery.
Do not use this when the data are proportions or counts (use proportion-z-test or chi-square-test), you have three or more groups (ANOVA), or you already have t and df and only need the p-value (use p-value).
What it computes: Runs a one-sample, Welch two-sample (unequal variances) or paired Student t-test from raw samples or summary statistics (mean, SD, n), returning t, degrees of freedom, two- and one-sided p-values, the confidence interval and the decision at the chosen alpha.
Example user requests: Run a one-sample t-test for [102, 98, 105, 101, 104] against a mean of 100. | Compare two independent samples with Welch's t-test from their means, sample SDs and sample sizes. | Run a paired t-test on these before and after measurements in matching order.
Inputs: mode (enum, optional); sample_a (number_list, optional); sample_b (number_list, optional); mean_a (number, optional); sd_a (number, optional); n_a (integer, optional); mean_b (number, optional); sd_b (number, optional); n_b (integer, optional); hypothesized_mean (number, optional); alpha (number, optional).
Valid input combinations: one_sample: sample_a, or all of mean_a + sd_a + n_a. two_sample (also the default when mode is omitted): one complete raw-or-summary input for A and one for B. paired: both sample_a + sample_b, or paired-difference summary mean_a + sd_a + n_a. Do not mix a raw sample with its summary fields.
Complete JSON argument examples: {"mode":"two_sample","sample_a":[5.1,4.9,5.6,5.8,6],"sample_b":[4.2,4.8,4.4,4.6,4.5]} | {"mode":"two_sample","mean_a":5.48,"sd_a":0.47117,"n_a":5,"mean_b":4.5,"sd_b":0.23452,"n_b":5} | {"mode":"one_sample","sample_a":[102,98,105,101,104],"hypothesized_mean":100} | {"mode":"paired","sample_a":[1.9,0.8,1.1,0.1,-0.1,4.4,5.5,1.6,4.6,3.4],"sample_b":[0.7,-1.6,-0.2,-1.2,-0.1,3.4,3.7,0.8,0,2]} | {"mode":"paired","mean_a":1.58,"sd_a":1.23042,"n_a":10}
Outputs: test, mean_a, mean_b, mean_difference, standard_error, t_statistic, degrees_of_freedom, p_value_two_sided, p_value_one_sided, t_critical, ci_lower, ci_upper, significant, decision.
Formula: one_sample: t = (x̄ − μ0) / (s / √n), df = n − 1. paired: same on the differences d = a − b. two_sample (Welch): t = (x̄a − x̄b − μ0) / √(sa²/na + sb²/nb), df = (sa²/na + sb²/nb)² / ((sa²/na)²/(na − 1) + (sb²/nb)²/(nb − 1)). p = P(|T_df| ≥ |t|); CI = estimate ± t(1 − alpha/2, df) × SE
Direct REST fallback: POST https://tttkmbb.com/api/v1/calculate/t-test with the same JSON input fields. Do not guess another /api/* path.
Docs: https://tttkmbb.com/statistics/t-test.md