Question About TTest
Question About TTest
Starting with the example from Lesson 27, we have
In[]:=
sample={1002.9,997.8,998.0,1000.1,1003.5,1000.7,1006.4,996.4,1000.3,1005.6,1002.3,1004.6,1000.0,1000.4,1003.9,1002.2,1003.4,1001.3,998.5,1002.9,999.7,1004.3,999.1,1001.8,1001.3};
Just for laughs compute
In[]:=
{Mean[sample],StandardDeviation[sample],Length[sample]}
Out[]=
{1001.5,2.53566,25}
FindDistribution[sample,3](*Normalisthesecondchoiceforthedistributionofsample*)
Out[]=
{UniformDistribution[{996.396,1006.41}],NormalDistribution[1001.5,2.75856],MixtureDistribution[{0.305694,0.694306},{NormalDistribution[1001.34,1.68593],UniformDistribution[{996.396,1006.41}]}]}
In[]:=
plot1=Histogram[sample,20,PlotRange->{{990,1010},{0,5}}]
Out[]=
Here is the example from the lesson:
TTest[sample,1000](*Thisisasshowninthelesson*)
Out[]=
0.00698764
Now test the effect of significance level
In[]:=
{TTest[sample,1000],TTest[sample,1000,SignificanceLevel->0.001],TTest[sample,1000,SignificanceLevel->0.1]}
{0.0069876366259665375`,0.0069876366259665375`,0.0069876366259665375`}(*Noapparenteffect*)
Now let’s look at the effect of standard deviation of the data.
data1=RandomVariate[NormalDistribution[1000,2.54],2500];TTest[data1,1000](*samestddeviationassample*)
Out[]=
0.754338
In[]:=
plot2=Histogram[data1,20,PlotRange->{{990,1010},{0,400}}]
Out[]=
In[]:=
data2=RandomVariate[NormalDistribution[1000,0.254],2500];TTest[data2,1000]
Out[]=
0.362097
In[]:=
plot3=Histogram[data2,20,PlotRange->{{990,1010},{0,400}}]
Out[]=
In[]:=
data3=RandomVariate[NormalDistribution[1000,0.0254],2500];TTest[data3,1000]
Out[]=
0.375226
In[]:=
plot4=Histogram[data3,20,PlotRange->{{990,1010},{0,400}}]
Out[]=
Two Questions:
1. How can it be that the p value for normally distributed data with the same mean and standard deviation as the sample dataset is so much larger than the p value for the sample data set?
2. Shouldn’t the p value decrease as the standard deviation of the data decreases with a constant mean?
1. How can it be that the p value for normally distributed data with the same mean and standard deviation as the sample dataset is so much larger than the p value for the sample data set?
2. Shouldn’t the p value decrease as the standard deviation of the data decreases with a constant mean?