UNPKG

@stdlib/stats

Version:

Standard library statistical functions.

79 lines (59 loc) 1.62 kB
{{alias}}( x, α, β ) Evaluates the natural logarithm of the probability density function (PDF) for an inverse gamma distribution with shape parameter `α` and scale parameter `β` at a value `x`. If `α <= 0` or `β <= 0`, the function returns `NaN`. If provided `NaN` as any argument, the function returns `NaN`. Parameters ---------- x: number Input value. α: number Shape parameter. β: number Scale parameter. Returns ------- out: number Evaluated logPDF. Examples -------- > var y = {{alias}}( 2.0, 0.5, 1.0 ) ~-2.112 > y = {{alias}}( 0.2, 1.0, 1.0 ) ~-1.781 > y = {{alias}}( -1.0, 4.0, 2.0 ) -Infinity > y = {{alias}}( NaN, 1.0, 1.0 ) NaN > y = {{alias}}( 0.0, NaN, 1.0 ) NaN > y = {{alias}}( 0.0, 1.0, NaN ) NaN // Negative shape parameter: > y = {{alias}}( 2.0, -1.0, 1.0 ) NaN // Negative scale parameter: > y = {{alias}}( 2.0, 1.0, -1.0 ) NaN {{alias}}.factory( α, β ) Returns a function for evaluating the natural logarithm of the probability density function (PDF) for an inverse gamma distribution with shape parameter `α` and scale parameter `β`. Parameters ---------- α: number Shape parameter. β: number Scale parameter. Returns ------- logpdf: Function Logarithm of probability density function (PDF). Examples -------- > var mylogPDF = {{alias}}.factory( 6.0, 7.0 ); > var y = mylogPDF( 2.0 ) ~-1.464 See Also --------