The Equal Variance Test is a statistical test used to determine if two random variances are equal. It uses the F-test to compare the observed sums of selected squares and determine if their ratio is significantly different from the null hypothesis that the variances are equal. The test is performed on two independent and identically distributed samples, and the sample means and variances are calculated. The test statistic is then calculated using the sample variances, and the resulting F value is compared to an F-distribution to calculate a p-value. The degrees of freedom for the F-distribution are set to (n-1) and (m-1), where n and m are the sample sizes.
------

SET SCHEMA DM_PAL;

DROP TABLE PAL_VAREQUALTEST_DATA1_TBL;
CREATE COLUMN TABLE PAL_VAREQUALTEST_DATA1_TBL (
    "X" INTEGER
);
INSERT INTO PAL_VAREQUALTEST_DATA1_TBL VALUES (1);
INSERT INTO PAL_VAREQUALTEST_DATA1_TBL VALUES (2);
INSERT INTO PAL_VAREQUALTEST_DATA1_TBL VALUES (4);
INSERT INTO PAL_VAREQUALTEST_DATA1_TBL VALUES (7);
INSERT INTO PAL_VAREQUALTEST_DATA1_TBL VALUES (3);

DROP TABLE PAL_VAREQUALTEST_DATA2_TBL;
CREATE COLUMN TABLE PAL_VAREQUALTEST_DATA2_TBL (
    "Y" DOUBLE
);
INSERT INTO PAL_VAREQUALTEST_DATA2_TBL VALUES (10);
INSERT INTO PAL_VAREQUALTEST_DATA2_TBL VALUES (15);
INSERT INTO PAL_VAREQUALTEST_DATA2_TBL VALUES (12);

DROP TABLE #PAL_PARAMETER_TBL;
CREATE LOCAL TEMPORARY COLUMN TABLE #PAL_PARAMETER_TBL (
    "PARAM_NAME" VARCHAR (256),
    "INT_VALUE" INTEGER,
    "DOUBLE_VALUE" DOUBLE,
    "STRING_VALUE" VARCHAR (1000)
);
INSERT INTO #PAL_PARAMETER_TBL VALUES ('TEST_TYPE',0,null,null); //default value is 0, it can be {0,1,2}

CALL "_SYS_AFL"."PAL_EQUAL_VARIANCE_TEST"(PAL_VAREQUALTEST_DATA1_TBL, PAL_VAREQUALTEST_DATA2_TBL, #PAL_PARAMETER_TBL, ?);

