ttest
One-sample and paired t-test
📝Syntax
h = ttest(x)
h = ttest(x, m)
h = ttest(x, y)
[h, p, ci, stats] = ttest(..., 'Alpha', alpha, 'Tail', tail, 'Dim', dim)
📥Input Arguments
Parameter Description
x real array: sample data.
m real scalar, 0 by default: hypothesized mean.
y real array with the same size as x: paired sample.
alpha scalar in (0,1), 0.05 by default: significance level.
tail 'both', 'right', or 'left'.
dim positive integer: dimension to operate along.
📤Output Arguments
Parameter Description
h logical array: test decision.
p array: p-values.
ci 2-row array: confidence intervals for the mean difference.
stats structure with tstat, df, and sd fields.
📄Description

ttest performs a t-test along the first non-singleton dimension unless Dim is specified.

NaN values are omitted from each tested slice.

💡Examples
x = [2 4 5 6 9];
[h, p, ci, stats] = ttest(x, 4);
[h2, p2] = ttest([4 6 7], [3 5 7], 'Tail', 'right');
🔗See Also
meanstd
🕔Version History
Version Description
2.0.0 initial version
Edit this page on GitHub