This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

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.

Perform t-Test

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

The t-Test compares the actual mean value of a data sample with the specified value m. The null hypothesis for this test states that the actual mean value is larger than m. For the t-Test, MuPAD® provides the stats::tTest function. For example, create the normally distributed data sequence of 1000 entries by using the stats::normalRandom function:

f := stats::normalRandom(1, 2):
x := [f() $ k = 1..1000]:

Now, use the stats::tTest function to test whether the actual mean value of x is larger than 1. Use the significance level 0.05. The returned p-value indicates the hypothesis passes the t-Test since the p-value exceeds the significance level.

stats::tTest(x, 1)

With the same significance level 0.05, the hypothesis that the actual mean value is larger than 2 does not pass the t-Test:

stats::tTest(x, 2)

Was this topic helpful?