Updated: 6 August 2010

Use FTEST_q to return the result of an F-test. An F-test returns the two-tailed probability that variance in dataset 1 and dataset 2 are not significantly different. Use this function to determine whether two samples have different variances.

SELECT [wctStatistics].[wct].[FTEST_q] (

<@Values1_RangeQuery, nvarchar(4000),>

,<@Values2_RangeQuery, nvarchar(4000),>)

the select statement, as text, used to determine the first set of values to be used in the FTEST_q calculation.

the select statement, as text, used to determine the second set of values to be used in the FTEST_q calculation.

float

· If the number of rows in dataset 1 or dataset 2 is less than 2, FTEST_q will return an error.

· If the variance of dataset 1 or the variance of dataset 2 is zero, FTEST_q will return a divide by zero error.

· For simple queries, consider using FTEST.

· No GROUP BY is required for this function even though it produces aggregated results.

CREATE TABLE #data1(

[num] [float] NOT NULL

)

INSERT INTO #data1 VALUES (6)

INSERT INTO #data1 VALUES (7)

INSERT INTO #data1 VALUES (9)

INSERT INTO #data1 VALUES (15)

INSERT INTO #data1 VALUES (21)

CREATE TABLE #data2(

[num] [float] NOT NULL

)

INSERT INTO #data2 VALUES (20)

INSERT INTO #data2 VALUES (28)

INSERT INTO #data2 VALUES (31)

INSERT INTO #data2 VALUES (38)

INSERT INTO #data2 VALUES (40)

Select wct.FTEST_q('Select num from #data1', 'Select num from #data2')

This produces the following result

----------------------

0.648317846786174

(1 row(s) affected)