Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function TTEST(array1, array2,tails,type) {
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;
}
if(type === 2){
if(tails === 1){
return jStat.anovaftest( array1, array2)/2 ;
}
if(tails === 2){
return jStat.anovaftest( array1, array2) ;
}
}
if(type === 1){
let array3 = array1.map((curValue,index) => array2[index] - curValue)
return jStat.ttest(0, array3, tails)
}
};
export function TTEST(array1, array2,tails,type) {
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;
}
if(type === 2){
if(tails === 1){
return jStat.anovaftest( array1, array2)/2 ;
}
if(tails === 2){
return jStat.anovaftest( array1, array2) ;
}
}
if(type === 1){
let array3 = array1.map((curValue,index) => array2[index] - curValue)
return jStat.ttest(0, array3, tails)
}
};