poissonLF2

fun poissonLF2(x: Double, mean: Double, recursive: Boolean = true): Double(source)

Computes the second-order loss function in the second factorial moment form, as in Zipkin, Foundations of Inventory Management (2000):

G2(x) = (1/2) * Emax(X - x, 0) * max(X - x - 1, 0)

At x = 0 this evaluates to 0.5 * mean^2 (because for Poisson EX(X-1) = mean^2), NOT 0.5 * (mean^2 + mean).

Note: some references define second-order loss as 0.5 * Emax(X - x, 0)^2 instead. The two conventions differ by mean/2 at x = 0. KSL uses the factorial-moment form throughout.

Return

The loss function value, (1/2) Emax(X-x,0) * max(X-x-1,0)

Parameters

x

The value to be evaluated

mean

of the distribution

recursive

true indicates that the recursive logarithmic algorithm should be used