@railpath/finance-toolkit
Version:
Production-ready finance library for portfolio construction, risk analytics, quantitative metrics, and ML-based regime detection
29 lines (28 loc) • 1.08 kB
TypeScript
/**
* Calculate Kurtosis (Fourth Moment) of a dataset
*
* Kurtosis measures the "tailedness" of the distribution:
* - Excess Kurtosis > 0: Heavy tails (leptokurtic) - more extreme values than normal distribution
* - Excess Kurtosis < 0: Light tails (platykurtic) - fewer extreme values than normal distribution
* - Excess Kurtosis = 0: Normal distribution (mesokurtic)
*
* This function returns the excess kurtosis (kurtosis - 3), which is commonly used in finance.
*
* Formula: Excess Kurtosis = E[(X - μ)⁴] / σ⁴ - 3
* Where:
* - μ = mean
* - σ = standard deviation
* - E[(X - μ)⁴] = fourth central moment
* - The -3 makes excess kurtosis = 0 for normal distribution
*
* @param data Array of numbers to calculate kurtosis for
* @returns Excess kurtosis value
*
* @example
* ```typescript
* const returns = [0.01, 0.02, -0.01, 0.03, -0.02, -0.05, 0.01];
* const kurtosis = calculateKurtosis(returns);
* console.log('Excess Kurtosis:', kurtosis); // 2.45 (fat tails)
* ```
*/
export declare function calculateKurtosis(data: number[]): number;