Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Nov 21, 2021
1 parent f403ec5 commit 6a14dd5
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/stats/precision.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { getAdjustedMoe, getMoe, getRmoe } from './moe.js'
import { getVarianceStats } from './variance.js'

// Retrieve stats related to `stdev` and precision.
// eslint-disable-next-line max-statements
export const getPrecisionStats = function ({
measures,
unsortedMeasures,
Expand All @@ -28,21 +27,18 @@ export const getPrecisionStats = function ({
maxIndex,
mean,
})

const envDev = getEnvDev(unsortedMeasures, {
mean,
variance,
filter: filterOutliers.bind(undefined, min, max),
})

const adjustedMoe = getAdjustedMoe(stdev, length, envDev)
const moe = getMoe(stdev, length)
const rmoe = getRmoe(moe, mean)
const { meanMin, meanMax } = getConfidenceInterval({
mean,
adjustedMoe,
const { moe, rmoe, meanMin, meanMax } = getMoeStats({
stdev,
envDev,
length,
min,
max,
mean,
})
return { stdev, rstdev, moe, rmoe, meanMin, meanMax, envDev }
}
Expand Down Expand Up @@ -110,3 +106,16 @@ const getPerfectPrecisionStats = function (mean) {
const filterOutliers = function (min, max, value) {
return value >= min && value <= max
}

const getMoeStats = function ({ stdev, envDev, length, min, max, mean }) {
const adjustedMoe = getAdjustedMoe(stdev, length, envDev)
const moe = getMoe(stdev, length)
const rmoe = getRmoe(moe, mean)
const { meanMin, meanMax } = getConfidenceInterval({
mean,
adjustedMoe,
min,
max,
})
return { moe, rmoe, meanMin, meanMax }
}

0 comments on commit 6a14dd5

Please sign in to comment.