{"uid":"cap_n8Xsb2NoVH9p33U6cZA7T","slug":"welch-t-test-two-sample-one-sample-dd037c4c","name":"Welch T-Test (Two-Sample & One-Sample)","description":"Welch two-sample or one-sample t-test: t statistic, degrees of freedom, p-value, confidence interval and Cohen's d.","url":"https://math-stats.x402tookit.com/t-test?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["a"],"properties":{"a":{"type":"string","description":"Sample A values"},"b":{"type":"string","description":"Sample B values (two-sample test)"},"mu":{"type":"number","description":"Hypothesised mean for a one-sample test (use instead of b)"},"alpha":{"type":"number","description":"Significance level 0.001 to 0.2 (default 0.05)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"nA":{"type":["null","number"]},"nB":{"type":["null","number"]},"asOf":{"type":["null","string"]},"test":{"type":["null","string"]},"alpha":{"type":["null","number"]},"meanA":{"type":["null","number"]},"meanB":{"type":["null","number"]},"source":{"type":["null","string"]},"cohensD":{"type":["null","number"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"difference":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"tStatistic":{"type":["null","number"]},"significant":{"type":["boolean","null"]},"standardError":{"type":["null","number"]},"pValueTwoSided":{"type":["null","number"]},"degreesOfFreedom":{"type":["null","number"]},"confidenceInterval":{"type":["null","object"],"properties":{"level":{"type":["null","number"]},"lower":{"type":["null","number"]},"upper":{"type":["null","number"]}}}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_EkgVUjZg6GWJJrC0uuFQl","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Performs a Welch two-sample or one-sample t-test, returning t statistic, degrees of freedom, p-value, confidence interval, and Cohen's d effect size.","exampleAgentPrompt":"Run a Welch two-sample t-test on these two groups — Group A: 23,25,28,22,27 and Group B: 30,35,33,31,29 — at the 0.05 significance level and tell me the p-value, t statistic, confidence interval, and Cohen's d.","exampleUseCases":[{"title":"Clinical trial group comparison","prompt":"I have measurements from a treatment group (14.2, 15.8, 13.9, 16.1, 15.0) and a control group (12.1, 11.8, 13.0, 12.5, 11.9). Run a Welch t-test at alpha 0.05 and tell me whether the difference is statistically significant and how large the effect is."},{"title":"Manufacturing quality check","prompt":"Our process is supposed to produce parts with a mean length of 50mm. I measured 10 parts: 50.2, 49.8, 51.1, 50.5, 49.6, 50.9, 50.3, 49.7, 51.0, 50.4. Run a one-sample t-test against mu=50 and tell me if we're significantly off target."},{"title":"Academic score comparison between cohorts","prompt":"Compare these two student cohorts' exam scores: Cohort A got 78,82,75,88,91,70 and Cohort B got 85,89,92,88,95,87. Use alpha 0.01 and give me the p-value, degrees of freedom, and whether the difference is significant."}],"resultDescription":"Returns a JSON object with: t statistic, degrees of freedom, two-sided p-value, confidence interval (lower, upper, level), Cohen's d effect size, means of each sample, sample sizes, difference between means, standard error, a boolean 'significant' flag, a human-readable summary and verdict, and the alpha level used.","failureModes":["Missing required sample A values returns an error","Sample with fewer than 2 values causes invalid degrees of freedom","Non-numeric values in sample strings cause parsing errors","Alpha outside 0.001–0.2 range rejected","Providing both b and mu simultaneously may cause ambiguous test specification","Very small samples may produce unreliable p-values flagged via degraded or reasons fields"],"whenToPreferThis":"Choose this endpoint when you need a rigorous parametric significance test comparing two independent groups (Welch t-test handles unequal variances) or testing a sample against a known population mean. It is more appropriate than a z-test when population variance is unknown or sample sizes are small, and better than a proportion z-test (see sibling endpoint) when the outcome variable is continuous. Prefer the correlation endpoint for measuring linear association rather than mean differences.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-30T00:35:22.650Z","isFirstParty":false,"canonicalSlug":"welch-t-test-two-sample-one-sample-dd037c4c"}