How to use the simple-statistics.quantile function in simple-statistics

To help you get started, we’ve selected a few simple-statistics 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 metaspace2020 / metaspace / metaspace / webapp / src / lib / ionImageRendering.ts View on Github external
function safeQuantile(values: number[], q: number | number[]): any {
  // Handle cases when `values` is empty gracefully
  if (values.length > 0) {
    return quantile(values, q as any)
  } else if (typeof q === 'number') {
    return 0
  } else {
    return q.map(() => 0)
  }
}
github IBM / openapi-to-graphql / test / evaluation / eval_apis_guru.js View on Github external
function printSummary (arr) {
  console.log(`mean: ${ss.mean(arr)}`)
  console.log(`min:  ${ss.min(arr)}`)
  console.log(`max:  ${ss.max(arr)}`)
  console.log(`---`)
  console.log(`25%:  ${ss.quantile(arr, 0.25)}`)
  console.log(`50%:  ${ss.quantile(arr, 0.50)}`)
  console.log(`75%:  ${ss.quantile(arr, 0.75)}`)
  console.log(`90%:  ${ss.quantile(arr, 0.9)}`)
}
github IBM / openapi-to-graphql / test / evaluation / eval_apis_guru.js View on Github external
function printSummary (arr) {
  console.log(`mean: ${ss.mean(arr)}`)
  console.log(`min:  ${ss.min(arr)}`)
  console.log(`max:  ${ss.max(arr)}`)
  console.log(`---`)
  console.log(`25%:  ${ss.quantile(arr, 0.25)}`)
  console.log(`50%:  ${ss.quantile(arr, 0.50)}`)
  console.log(`75%:  ${ss.quantile(arr, 0.75)}`)
  console.log(`90%:  ${ss.quantile(arr, 0.9)}`)
}
github IBM / openapi-to-graphql / test / evaluation / eval_apis_guru.js View on Github external
function printSummary (arr) {
  console.log(`mean: ${ss.mean(arr)}`)
  console.log(`min:  ${ss.min(arr)}`)
  console.log(`max:  ${ss.max(arr)}`)
  console.log(`---`)
  console.log(`25%:  ${ss.quantile(arr, 0.25)}`)
  console.log(`50%:  ${ss.quantile(arr, 0.50)}`)
  console.log(`75%:  ${ss.quantile(arr, 0.75)}`)
  console.log(`90%:  ${ss.quantile(arr, 0.9)}`)
}
github nothingisdead / pg-live-query / test / load / setup.es6 View on Github external
console.table([ 0.05, 0.25, 0.5, 0.75, 0.95, 1 ].map(percentile => {
			return {
				'Percentile': percentile * 100,
				'Time (ms)': Math.round(stats.quantile(waitingPrepTable, percentile))
			}
		}))
	}
github IBM / openapi-to-graphql / test / evaluation / eval_apis_guru.js View on Github external
function printSummary (arr) {
  console.log(`mean: ${ss.mean(arr)}`)
  console.log(`min:  ${ss.min(arr)}`)
  console.log(`max:  ${ss.max(arr)}`)
  console.log(`---`)
  console.log(`25%:  ${ss.quantile(arr, 0.25)}`)
  console.log(`50%:  ${ss.quantile(arr, 0.50)}`)
  console.log(`75%:  ${ss.quantile(arr, 0.75)}`)
  console.log(`90%:  ${ss.quantile(arr, 0.9)}`)
}
github numtel / mysql-live-select / test / load / setup.es6 View on Github external
console.table([ 0.05, 0.25, 0.5, 0.75, 0.95, 1 ].map(percentile => {
      return {
        'Percentile': percentile * 100,
        'Time (ms)': Math.round(stats.quantile(allResponseTimes, percentile))
      }
    }))
github antvis / data-set / test / unit / api / statistics-spec.ts View on Github external
const dv = new DataSet.View().source(populationChina);
    dv.transform({
      type: 'map',
      callback(row) {
        row.year = parseInt(row.year, 10);
        return row;
      },
    });
    const years = dv.getColumn('year');
    expect(dv.max('year')).to.equal(max(years));
    expect(dv.min('year')).to.equal(min(years));
    expect(dv.mean('year')).to.equal(mean(years));
    expect(dv.average('year')).to.equal(mean(years));
    expect(dv.median('year')).to.equal(median(years));
    expect(dv.mode('year')).to.equal(mode(years));
    expect(dv.quantile('year', 0.5)).to.equal(quantile(years, 0.5));
    expect(dv.quantiles('year', [0, 0.1, 0.5])).to.eql(map([0, 0.1, 0.5], (p) => quantile(years, p)));
    expect(dv.quantilesByFraction('year', 4)).to.eql(map([0, 0.25, 0.5, 0.75, 1], (p) => quantile(years, p)));
    expect(dv.standardDeviation('year')).to.equal(standardDeviation(years));
    expect(dv.sum('year')).to.equal(sum(years));
    expect(dv.variance('year')).to.equal(variance(years));
    expect(dv.range('year')).to.eql([min(years), max(years)]);
  });
github antvis / data-set / src / transform / bin / quantile.ts View on Github external
    const quantiles = pArray.map((p) => quantile(binningColumn, p));
    resultRow[as] = quantiles;