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:

 n1 100 Mean1 99.8754 Stdv1 3.39174 degreesOfFreedom1 99 n2 80 Mean2 79.6029 Stdv2 3.10709 degreesOfFreedom2 79 F 1.19162 lowCriticalValue 0.659763 highCriticalValue 1.53104 P 0.418974 Accept 1

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:

 n1 100 Mean1 99.8754 Stdv1 3.39174 degreesOfFreedom1 99 n2 80 Mean2 80.5489 Stdv2 4.43966 degreesOfFreedom2 79 F 0.583641 lowCriticalValue 0.659763 highCriticalValue 1.53104 P 0.0112429 Accept 0

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`
 n1 100 Mean1 99.8754 Stdv1 3.39174 degreesOfFreedom1 99 n2 80 Mean2 80.5489 Stdv2 4.43966 degreesOfFreedom2 79 F 0.583641 Critical 0.70553 P 0.00562143 Accept 0

H0 is rejected here as one would expect. Similarly,

`StatsFTest/T=1/Q/TAIL=2  data1,data3`
 n1 100 Mean1 99.8754 Stdv1 3.39174 degreesOfFreedom1 99 n2 80 Mean2 80.5489 Stdv2 4.43966 degreesOfFreedom2 79 F 0.583641 Critical 1.4289 P 0.00562143 Accept 1

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

Forum

Support

Gallery