此为 Mathematica 7 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.2)
Mathematica HowTo
How to | Test Hypotheses for Population Means
Many times in statistical analysis you may need to know if a population mean is significantly different from some reference value. This is a type of t-test if the population variance is not known. The Hypothesis Testing Package, which is included with Mathematica, can be used to test hypotheses for population means.
First, generate a sample dataset:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Perform a t-test with MeanTest. This will return the p-value of the test with null hypothesis that the population mean is 9. By default, MeanTest returns the one-sided p-value:
In[3]:=
Click for copyable input
Out[3]=
Get the two-sided p-value for the same test:
In[4]:=
Click for copyable input
Out[4]=
Use MeanDifferenceTest if you need a test to decide whether the difference between two population means differs significantly from an assumed value. In this case, the null hypothesis is that the population means are equal (differ by 0):
In[5]:=
Click for copyable input
Out[5]=
Out[5]=
Test with a null hypothesis that the population mean of data is 4 greater than that of data2:
In[6]:=
Click for copyable input
Out[6]=
Tests can also be done for paired comparisons of datasets. This can be done by using MeanTest on the pairwise differences:
In[7]:=
Click for copyable input
Out[7]=