T-Test Calculator
calculate_t_testUse 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
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n_a | No | Number of observations in A, or number of pairs. | |
| n_b | No | Number of observations in B. | |
| mode | No | Which t-test to run. | two_sample |
| sd_a | No | Sample standard deviation (n − 1) of A, or of the paired differences. | |
| sd_b | No | Sample standard deviation (n − 1) of B. | |
| alpha | No | Significance level as a probability (0.05 = 5 %), not a percentage. Confidence intervals and critical values use level 1 − alpha. | |
| mean_a | No | Summary alternative to sample_a: sample mean of A (in paired mode: mean of the differences a − b). | |
| mean_b | No | Summary alternative to sample_b (two_sample only): sample mean of B. | |
| sample_a | No | Raw observations of the first (or only) sample. Alternatively give mean_a, sd_a and n_a. | |
| sample_b | No | Raw observations of the second sample (two_sample) or the paired partner values in the same order (paired). Alternatively give mean_b, sd_b and n_b. | |
| hypothesized_mean | No | Null-hypothesis value: the population mean (one_sample) or the mean difference (two_sample, paired). Usually 0 for differences. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| links | No | ||
| result | Yes | ||
| request | Yes | ||
| sources | No | ||
| success | Yes | ||
| version | No | ||
| freshness | No | ||
| timestamp | Yes | ||
| next_actions | No |