quantitivecalc
Version:
A TypeScript library providing advanced quantitative finance functions for risk analysis, performance metrics, and technical indicators. (Currently in development)
26 lines (25 loc) • 925 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getZScore = getZScore;
/**
* Returns the Z-score corresponding to a given confidence level.
*
* Common confidence levels and their Z-scores:
* - 0.01 (99% confidence): -2.326
* - 0.05 (95% confidence): -1.645
* - 0.10 (90% confidence): -1.282
*
* If the provided confidence level is not found, defaults to the Z-score for 95% confidence (-1.645).
*
* @param confidenceLevel - The confidence level as a decimal (e.g., 0.05 for 95% confidence).
* @returns The Z-score associated with the given confidence level.
*/
function getZScore(confidenceLevel) {
// Common confidence levels and their Z-scores
const zScores = {
0.01: -2.326, // 99% confidence
0.05: -1.645, // 95% confidence
0.1: -1.282, // 90% confidence
};
return zScores[confidenceLevel] || -1.645; // Default to 95% confidence
}