Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!array1 || !array2) {
return errorObj.ERROR_NA;
}
if (!(array1 instanceof Array) || !(array2 instanceof Array)) {
return errorObj.ERROR_NA;
}
if (array1.length < 2 || array2.length < 2) {
return errorObj.ERROR_DIV0;
}
let sum1 = jStat.variance(array1);
let sum2 = jStat.variance(array2);
if(sum1 >= sum2){
return 2*jStat.ftest(sum1/sum2,array1.length - 1,array2.length - 1);
}
if(sum2 > sum1){
return 2*jStat.ftest(sum2/sum1,array2.length - 1,array1.length - 1);
}
};
exports.F.TEST = function (array1, array2) {
if (!array1 || !array2) {
return Error(ERROR_NA);
}
if (!(array1 instanceof Array) || !(array2 instanceof Array)) {
return Error(ERROR_NA);
}
if (array1.length < 2 || array2.length < 2) {
return Error(ERROR_DIV0);
}
let sum1 = jStat.variance(array1);
let sum2 = jStat.variance(array2);
if (sum1 >= sum2) {
return 2 * jStat.ftest(sum1 / sum2, array1.length - 1, array2.length - 1);
}
if (sum2 > sum1) {
return 2 * jStat.ftest(sum2 / sum1, array2.length - 1, array1.length - 1);
}
};