mqr.spc.util.

d3_integral#

mqr.spc.util.d3_integral(n, d2_fn=None, **dblquad_kws)#

Numerical integration to calculate the d3 unbiasing constant.

Evaluates:

\[d_3(n) = \sqrt{ 2\int_{-\infty}^{\infty} \int_{-\infty}^{y} f_3(x, y; n) dx dy - d_2^2(n) },\]

where

\[f_3(x, y; n) = 1 - \Phi(y)^n - (1 - \Phi(x))^n + (\Phi(y) - \Phi(x))^n.\]

Evaluating the integral is slightly quicker with the transform (which is a rotation of the plane through 45 degrees)

\[\begin{split}x = \frac{s - t}{\sqrt{2}}, \\ y = \frac{s + t}{\sqrt{2}}\end{split}\]

over \(s \in (-\infty, \infty)\) and \(t \in [0, \infty)\). The transform’s Jacobian has determinant equal to 1, so the integral is evaluated as

\[d_3(n) = \sqrt{ 2\int_{0}^{\infty} \int_{-\infty}^{\infty} f_3\left(\frac{s - t}{\sqrt{2}}, \frac{s + t}{\sqrt{2}}; n\right) dx dy - d_2^2(n) } .\]
Parameters:
nint

Sample size

d2_fnCallable[int, float], optional

Function evaluating the d2 unbiasing constant. Default is mqr.spc.util.d2.

**dblquad_kwsdict

Keyword args passed as **dblquad_kws to scipy.integrate.dblquad.

Returns:
float

Notes

Uses a substitution that removes the limit’s dependence on variables.