Function: devig_shin()
devig_shin(
p_raw):number[]
Defined in: src/odds/math.ts:236
Vig removal with Shin's (1993) insider-trading method (py devig_shin).
Solves for the insider share z at which the Shin probabilities sum to 1 (a port of
scipy's brentq on [0, 1 - 1e-9], xtol = 1e-12), then renormalizes.
Parameters
p_raw
readonly number[]
Raw implied probabilities of every outcome of one market.
Returns
number[]
A new array of devigged probabilities in p_raw order, summing to 1.
Throws
OddsZeroDivisionError When the booksum is <= 1 and the multiplicative fallback
divides by a zero sum (non-empty p_raw).
Throws
OddsRuntimeError When the root solver does not converge in 100 iterations.
Remarks
With booksum (overround) <= 1 this reduces to devig_multiplicative.
If the solver cannot bracket a root (or hits a NaN) it warns
Shin solver failed to bracket (...) (a Node process warning named SdvWarning,
console.warn elsewhere) once per distinct message per process and falls back to
the multiplicative method, as sdv-py warns.
Example
import sdv from 'sportsdataverse';
sdv.odds.devig_shin([0.6, 0.4347826086956522]); // [0.58..., 0.41...], sums to 1