momentExists

fun momentExists(j: Int, coefficients: DoubleArray, boundedness: MetalogBoundedness): Boolean(source)

Whether the moment of the given order is finite.

This matters because a semi-bounded metalog can easily fail to have the moments one would casually assume it has. The unbounded member diverges only logarithmically at each endpoint, so all of its moments are finite, and the bounded member has compact support, so all of its moments are finite. The semi-bounded members, however, exponentiate the quantile function, which converts that logarithmic divergence into a power law. A lower bounded metalog whose upper tail logit weight is one half has a finite mean but an infinite variance, and one whose weight reaches one has no finite mean at all.

Numerical integration cannot detect this on its own. Truncating the integral near the endpoint always yields a finite number, so quadrature would report a large value rather than reporting divergence. Callers should consult this function before trusting a quadrature result for a semi-bounded metalog.

The criterion is asymptotic, so a case sitting exactly on the boundary is reported as not existing, and accuracy degrades for cases approaching it.

Parameters

j

the order of the moment, which must be at least one

coefficients

the metalog coefficients

boundedness

which member of the family is in use