Overview
A simple way to estimate credit loss is to aggregate credit losses to a set of periods (such as yearly) and then to apply the tools of time series analysis.
Sample loss data as a time series. The loss is stated as a rate, which when multiplied by the total portfolio value gives the
loss for the period.
Basic Statistics
in general, loss data will need to assumed to be stationary so that one can simply apply a set of statistics. (see moments)
- Average (Mean)
- Standard Deviation
Implementation
The following sample code utilizes the moments library
let mt = await import('/lib/statistics/moments/v1.0.0/moments.mjs');
let average = mt.average(data.map(p=>p.rate));
let stdDev = Math.sqrt(mt.variance(data.map(p=>p.rate)));