How to use the jstat.anovaftest function in jstat

To help you get started, we’ve selected a few jstat examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zhilu-nanjing / financial-cell / test / mycode / myfunc.js View on Github external
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)
    }
};
github zhilu-nanjing / financial-cell / test / mycode / myfunc.js View on Github external
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)
    }
};