Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

One-sample and paired-sample *t*-test

`h = ttest(x)`

`h = ttest(x,y)`

`h = ttest(x,y,Name,Value)`

`h = ttest(x,m)`

`h = ttest(x,m,Name,Value)`

```
[h,p] =
ttest(___)
```

```
[h,p,ci,stats]
= ttest(___)
```

returns
a test decision for the null hypothesis that the data in `h`

= ttest(`x`

)`x`

comes
from a normal distribution with mean equal to zero and unknown variance,
using the one-sample *t*-test.
The alternative hypothesis is that the population distribution does
not have a mean equal to zero. The result `h`

is `1`

if
the test rejects the null hypothesis at the 5% significance level,
and `0`

otherwise.

returns
a test decision for the paired-sample `h`

= ttest(`x`

,`y`

,`Name,Value`

)*t*-test with
additional options specified by one or more name-value pair arguments.
For example, you can change the significance level or conduct a one-sided
test.

returns
a test decision for the one-sample `h`

= ttest(`x`

,`m`

,`Name,Value`

)*t*-test with
additional options specified by one or more name-value pair arguments.
For example, you can change the significance level or conduct a one-sided
test.

Use

`sampsizepwr`

to calculate:The sample size that corresponds to specified power and parameter values;

The power achieved for a particular sample size, given the true parameter value;

The parameter value detectable with the specified sample size and power.

`sampsizepwr`

| `ttest2`

| `ztest`