{
  "name": "MATLAB t-test functions by study design",
  "description": "Compares the five usual t-test designs in MATLAB's Statistics and Machine Learning Toolbox: the function and call, the null hypothesis the documentation states, and what the sd output holds. Compiled from the MathWorks ttest, ttest2 and vartest2 reference pages, read 2026-11-17.",
  "page": "https://casrai.org/guides/t-test-in-matlab",
  "publisher": "CASRAI",
  "license": "https://creativecommons.org/licenses/by/4.0/",
  "dateModified": "2026-11-19T08:15:00Z",
  "temporalCoverage": "Documentation read 2026-11-17",
  "spatialCoverage": null,
  "columns": [
    {
      "name": "Design",
      "unit": "",
      "description": ""
    },
    {
      "name": "MATLAB call",
      "unit": "",
      "description": ""
    },
    {
      "name": "Null hypothesis stated in documentation",
      "unit": "",
      "description": ""
    },
    {
      "name": "What stats.sd holds",
      "unit": "",
      "description": ""
    },
    {
      "name": "Size or variance rule",
      "unit": "",
      "description": ""
    }
  ],
  "rows": [
    {
      "Design": "One sample",
      "MATLAB call": "ttest(x) or ttest(x,m)",
      "Null hypothesis stated in documentation": "Data are normal with mean 0 (or m) and unknown variance",
      "What stats.sd holds": "Estimated standard deviation of x",
      "Size or variance rule": "m defaults to 0"
    },
    {
      "Design": "Paired samples",
      "MATLAB call": "ttest(x,y)",
      "Null hypothesis stated in documentation": "Paired differences x-y have mean zero",
      "What stats.sd holds": "Standard deviation of x-y",
      "Size or variance rule": "x and y must be the same size"
    },
    {
      "Design": "Two samples, equal variances",
      "MATLAB call": "ttest2(x,y)",
      "Null hypothesis stated in documentation": "Both samples are normal with equal means; variances equal but unknown (default)",
      "What stats.sd holds": "Pooled standard deviation",
      "Size or variance rule": "Vartype is 'equal' by default; NaN ignored as missing"
    },
    {
      "Design": "Two samples, unequal variances",
      "MATLAB call": "ttest2(x,y,'Vartype','unequal')",
      "Null hypothesis stated in documentation": "Both samples are normal with equal means; variances not assumed equal",
      "What stats.sd holds": "Vector of unpooled standard deviations",
      "Size or variance rule": "Satterthwaite degrees of freedom (Behrens-Fisher problem)"
    },
    {
      "Design": "Equal-variance pre-check",
      "MATLAB call": "vartest2(x,y)",
      "Null hypothesis stated in documentation": "Both samples are normal with equal variances",
      "What stats.sd holds": "Not applicable (F-test)",
      "Size or variance rule": "Separate function in the same toolbox"
    }
  ],
  "sources": [
    {
      "title": "MathWorks: ttest",
      "url": "https://www.mathworks.com/help/stats/ttest.html",
      "accessed": "2026-11-17"
    },
    {
      "title": "MathWorks: ttest2",
      "url": "https://www.mathworks.com/help/stats/ttest2.html",
      "accessed": "2026-11-17"
    },
    {
      "title": "MathWorks: vartest2",
      "url": "https://www.mathworks.com/help/stats/vartest2.html",
      "accessed": "2026-11-17"
    }
  ]
}