You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@tracerbench/stats

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tracerbench/stats - npm Package Compare versions

Comparing version

to
4.5.1

7

dist/src/stats.d.ts

@@ -67,2 +67,8 @@ export interface Bucket {

};
readonly populationVariance: {
control: number;
experiment: number;
};
readonly control: number[];
readonly experiment: number[];
constructor(options: IStatsOptions);

@@ -77,3 +83,4 @@ private getOutliers;

private getBuckets;
private getPopulationVariance;
}
//# sourceMappingURL=stats.d.ts.map

@@ -12,2 +12,4 @@ "use strict";

const { name, control, experiment, confidenceLevel } = options;
this.control = control;
this.experiment = experiment;
// explicitly for NOT sorted

@@ -51,2 +53,6 @@ this.controlMS = control.map((x) => Math.round(utils_1.convertMicrosecondsToMS(x)));

this.buckets = this.getBuckets(this.controlSortedMS, this.experimentSortedMS);
this.populationVariance = {
control: this.getPopulationVariance(this.controlSortedMS),
experiment: this.getPopulationVariance(this.experimentSortedMS)
};
}

@@ -153,2 +159,3 @@ getOutliers(a, sevenFigSum) {

// within each bucket regardless of comparator
// and without overlap
buckets.map((bucket) => {

@@ -168,4 +175,14 @@ controlSortedMS.map((sample) => {

}
getPopulationVariance(a) {
const _mean = d3_array_1.mean(a);
let sum = 0;
if (_mean) {
a.map((n) => {
sum = sum + Math.pow(n - _mean, 2);
});
}
return utils_1.toNearestHundreth(sum / a.length);
}
}
exports.Stats = Stats;
//# sourceMappingURL=stats.js.map

30

package.json
{
"name": "@tracerbench/stats",
"version": "4.5.0",
"version": "4.5.1",
"description": "Stats class written in TS-Node",

@@ -37,23 +37,23 @@ "keywords": [

"tmp": "^0.2.1",
"tslib": "^2.0.1"
"tslib": "^2.0.3"
},
"devDependencies": {
"@types/chai": "^4.2.12",
"@types/d3-array": "^2.0.0",
"@types/d3-scale": "^2.2.0",
"@types/fs-extra": "^9.0.1",
"@types/node": "^14.11.2",
"@types/chai": "^4.2.14",
"@types/d3-array": "^2.8.0",
"@types/d3-scale": "^3.2.1",
"@types/fs-extra": "^9.0.4",
"@types/node": "^14.14.7",
"@types/tmp": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^4.2.0",
"@typescript-eslint/parser": "^4.2.0",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"chai": "^4.2.0",
"chai-files": "^1.4.0",
"eslint": "^7.9.0",
"eslint-config-prettier": "^6.11.0",
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-oclif": "^0.1.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-simple-import-sort": "^5.0.3",
"mocha": "^8.1.3",
"mocha": "^8.2.1",
"mock-fs": "^4.13.0",

@@ -63,7 +63,7 @@ "nyc": "^15.1.0",

"ts-node": "^9.0.0",
"typescript": "^4.0.3",
"typescript": "^4.0.5",
"typescript-json-schema": "^0.43.0"
},
"engine": "node >= 10",
"gitHead": "04279ba7bba961c4201e0b555cb7f09e3b1593c5"
"gitHead": "5162c47520dea2158493aa80fc8eea92bdda78bc"
}

@@ -1,6 +0,6 @@

import { cross, histogram, quantile } from 'd3-array';
import { cross, histogram, mean, quantile } from 'd3-array';
import { scaleLinear } from 'd3-scale';
import { confidenceInterval } from './confidence-interval';
import { convertMicrosecondsToMS } from './utils';
import { convertMicrosecondsToMS, toNearestHundreth } from './utils';

@@ -68,4 +68,9 @@ export interface Bucket {

public readonly range: { min: number; max: number };
public readonly populationVariance: { control: number; experiment: number };
public readonly control: number[];
public readonly experiment: number[];
constructor(options: IStatsOptions) {
const { name, control, experiment, confidenceLevel } = options;
this.control = control;
this.experiment = experiment;
// explicitly for NOT sorted

@@ -167,2 +172,6 @@ this.controlMS = control.map((x) => Math.round(convertMicrosecondsToMS(x)));

);
this.populationVariance = {
control: this.getPopulationVariance(this.controlSortedMS),
experiment: this.getPopulationVariance(this.experimentSortedMS)
};
}

@@ -313,2 +322,3 @@

// within each bucket regardless of comparator
// and without overlap
buckets.map((bucket) => {

@@ -329,2 +339,19 @@ controlSortedMS.map((sample) => {

}
private getPopulationVariance(a: number[]): number {
const _mean = mean(a);
let sum = 0;
if (_mean) {
a.map((n) => {
sum = sum + Math.pow(n - _mean, 2);
});
}
return toNearestHundreth(sum / a.length);
}
// private getPower(): number {
// // increase sample size, increases power
// // decrease variance, increases power
// }
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet