Note: This page has been translated by MathWorks. Please click here

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

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

Two-sample *t*-test

`h = ttest2(x,y)`

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

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

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

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

= ttest2(`x`

,`y`

)`x`

and `y`

comes
from independent random samples from normal distributions with equal
means and equal but unknown variances, using the two-sample *t*-test.
The alternative hypothesis is that the data in `x`

and `y`

comes
from populations with unequal means. 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 two-sample `h`

= ttest2(`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 the
test without assuming equal variances.

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`

| `ttest`

| `ztest`

Was this topic helpful?