Bookmark this: tool.io/statistics/bonferroni-correction/source-code
Bonferroni Correction Calculator Source Code
Browse the implementation files for Bonferroni Correction Calculator.tool.ts typescript
import { calculateBonferroniCorrection } from '@tool.io/tools/statistics/bonferroni-correction';
export const bonferroniCorrection = (
pValue: unknown,
comparisons: unknown
): string => {
if (
pValue === '' ||
pValue === null ||
pValue === undefined ||
comparisons === '' ||
comparisons === null ||
comparisons === undefined
)
return '';
const result = calculateBonferroniCorrection({
comparisons: Number(comparisons),
pValue: Number(pValue)
});
return result.ok ? String(result.output.adjustedPValue) : '';
};
export const Tool: TypeTool = {
name: 'Bonferroni Correction Calculator',
slug: 'statistics/bonferroni-correction',
intro:
'Adjust a p-value for multiple comparisons using the Bonferroni correction.',
tool: bonferroniCorrection,
i: [
{
example: '0.01',
label: 'P-value',
placeholder: 'Unadjusted p-value',
type: 'number'
},
{
example: '5',
label: 'Comparisons',
placeholder: 'Number of comparisons',
type: 'number'
}
],
o: [
{
example: '0.05',
label: 'Adjusted P-value',
placeholder: 'Adjusted p-value will appear here...',
type: 'number'
}
],
equation: '$$p_{adjusted}=\\min(1,mp)$$'
};
export default Tool;
Description
Browse the implementation files for Bonferroni Correction Calculator.