{"uid":"cap_FKxF5J8_ewmKA_XwT0CnQ","slug":"statistical-tests-power-sample-size-for-t-tests-bdd8643f","name":"Statistical Tests – Power & Sample Size for t-Tests","description":"Sample size for a two-sample, one-sample or paired t-test from effect size, alpha and power; or the power for a given size.","url":"https://stats-tests.x402tookit.com/power-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":["effectSize"],"properties":{"alpha":{"type":"number","description":"Two-sided significance level (default 0.05)"},"power":{"type":"number","description":"Desired power, 0.5 to 0.99 (default 0.8)"},"design":{"type":"string","description":"two-sample (default), one-sample or paired"},"nPerGroup":{"type":"integer","description":"If given, returns the power for this sample size instead"},"effectSize":{"type":"number","description":"Cohen's d (0.2 small, 0.5 medium, 0.8 large)"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"alpha":{"type":["null","number"]},"power":{"type":["null","number"]},"zBeta":{"type":["null","number"]},"design":{"type":["null","string"]},"source":{"type":["null","string"]},"zAlpha":{"type":["null","number"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"nPerGroup":{"type":["null","number"]},"unrounded":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"effectSize":{"type":["null","number"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"totalSubjects":{"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_S9jcrlx9X_27vOGb2-9Qu","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":"Calculates the required sample size for a t-test given effect size, alpha, and power — or returns the achieved power for a given sample size.","exampleAgentPrompt":"What sample size do I need per group for a two-sample t-test with a medium effect size (Cohen's d = 0.5), alpha of 0.05, and 80% power?","exampleUseCases":[{"title":"Clinical trial participant planning","prompt":"I'm designing a clinical trial comparing two treatment groups. If I expect a medium effect (Cohen's d = 0.5), want 80% power, and will use alpha = 0.05, how many patients do I need per group?"},{"title":"Checking power for a fixed sample size","prompt":"I only have 40 participants per group for my two-sample t-test and expect a small effect size of Cohen's d = 0.2 at alpha = 0.05 — what statistical power will I actually achieve?"},{"title":"Paired study design sample size","prompt":"I'm running a before-and-after paired study and expect a large effect (Cohen's d = 0.8). With alpha = 0.05 and desired power of 90%, how many subjects do I need to recruit?"}],"resultDescription":"Returns the required sample size per group (nPerGroup) and total subjects for the given parameters, or the achieved power if nPerGroup is supplied. Also includes the z-alpha, z-beta values, design label, a human-readable summary, verdict, unrounded sample size, and a disclaimer — with any reasons for degraded results flagged.","failureModes":["Missing effectSize parameter returns an error","Power value outside 0.5–0.99 range may be rejected or produce edge results","Very small effect sizes may yield impractically large sample sizes","Invalid design string (not 'two-sample', 'one-sample', or 'paired') returns error","Alpha or power values outside valid ranges return validation errors"],"whenToPreferThis":"Choose this endpoint when you need a fast, stateless computation of t-test sample size or power — ideal for study planning, grant proposals, or sanity-checking an existing design without running full simulation software. Prefer it over general statistics libraries when you want a pay-per-call API with no setup and Cohen's d as the primary effect size measure.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T07:19:03.203Z","isFirstParty":false,"canonicalSlug":"statistical-tests-power-sample-size-for-t-tests-bdd8643f"}