All files inferential.ts

55% Statements 11/20
100% Branches 0/0
0% Functions 0/2
55% Lines 11/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201x 1x 1x 1x 1x 1x     1x 1x               1x 1x 1x
import Descriptive from "./descriptive";
 
export default class Inferential {
    descriptives: Array<Descriptive>;
 
    constructor (descriptives: Array<Descriptive>) {
        this.descriptives = descriptives;
    }
 
    oneSampleT(populationMean: number, descriptiveName: string, rounded: number|false = false) {
        var descriptive: Descriptive = this.descriptives.filter((descriptive) => descriptive.name == descriptiveName)[0];

        var numerator = ( descriptive.summary.mean - populationMean );
        var denominator = ( descriptive.summary.standardDeviation/Math.sqrt(descriptive.size) );

        return rounded ? parseFloat(Number(numerator/denominator).toFixed(rounded)): Number(numerator/denominator);
    }
    
    // twoSampleT
}