F-Test Example

In this example we test the equality of the variances of two data sets that belong to a normal distribution. We start this example by creating 3 waves of different statistics. The first pair (data1 and data2) have the same variance but different means. The second pair (data2 and data3) have the same mean but different variance. To create the data execute the commands:

Make/n=100 data1=100+gnoise(3)
Make/n=80 data2=80+gnoise(3)
Make/N=90 data3=80+gnoise(4)

Comparing the variance of two waves using a two-tailed hypothesis

To run the test execute the command:

StatsFTest/T=1/Q  data1,data2

The results of the test appear in the F-Test table:

n1100
Mean199.8754
Stdv13.39174
degreesOfFreedom199
n280
Mean279.6029
Stdv23.10709
degreesOfFreedom279
F1.19162
lowCriticalValue0.659763
highCriticalValue1.53104
P0.418974
Accept1

The F statistic is within the critical range so the two-tailed hypothesis of equal variances is accepted.

Testing in the case of unequal variances (two tails test)

To run the test execute the following command:

StatsFTest/T=1/Q  data1,data3

The results of the test appear in the F-Test table:

n1100
Mean199.8754
Stdv13.39174
degreesOfFreedom199
n280
Mean280.5489
Stdv24.43966
degreesOfFreedom279
F0.583641
lowCriticalValue0.659763
highCriticalValue1.53104
P0.0112429
Accept0

The rejection of H0 in this case is pretty sensitive to the choice of significance. It is apparent from the P-value that it would have been accepted if alpha was set to 0.01.

One-tail testing for the same data

First H0: the variance of the first sample is greater than the variance of the second. To run the test execute the command:

StatsFTest/T=1/Q/TAIL=1  data1,data3
n1100
Mean199.8754
Stdv13.39174
degreesOfFreedom199
n280
Mean280.5489
Stdv24.43966
degreesOfFreedom279
F0.583641
Critical0.70553
P0.00562143
Accept0

H0 is rejected here as one would expect. Similarly,

StatsFTest/T=1/Q/TAIL=2  data1,data3
n1100
Mean199.8754
Stdv13.39174
degreesOfFreedom199
n280
Mean280.5489
Stdv24.43966
degreesOfFreedom279
F0.583641
Critical1.4289
P0.00562143
Accept1

Here the F is smaller than the critical value so the two-tailed hypothesis can't be rejected.