second Order Loss Function
Second order loss function G2(x) = (1/2)Emax(X-x,0)*max(X-x-1,0).
Both factors are clamped at zero, as the definition says. Guarding only the first would admit a support point sitting strictly between x and x+1, whose second factor is then negative, and a second order loss function — half the expectation of a product of two non-negative quantities — cannot be negative. Unlike the integer-supported distributions, an empirical support can place a point anywhere, so the second guard is load-bearing here rather than redundant.
Requires a whole-number support. Each order of a loss function is the accumulation of the order below it, over the integers on a discrete support. A support placed off the integers has no such accumulation, and the sum below would then return a quantity that is neither it nor the continuous (1/2)Emax(X-x,0)^2 — for support (2.3, 5.1, 9.8, 14.4) it returns 32.9995 at x = 0, against 36.7895 for the integral and 33.08 for the sum over the integers. Rather than pick one silently, this refuses. firstOrderLossFunction is the same expression on every support and carries no such restriction.
Throws
if any support point is not a whole number