UNPKG

@stdlib/stats

Version:

Standard library statistical functions.

73 lines (56 loc) 1.51 kB
{{alias}}( x, μ, b ) Evaluates the logarithm of the probability density function (PDF) for a Laplace distribution with scale parameter `b` and location parameter `μ` at a value `x`. If provided `NaN` as any argument, the function returns `NaN`. If provided `b <= 0`, the function returns `NaN`. Parameters ---------- x: number Input value. μ: number Location parameter. b: number Scale parameter. Returns ------- out: number Evaluated logPDF. Examples -------- > var y = {{alias}}( 2.0, 0.0, 1.0 ) ~-2.693 > y = {{alias}}( -1.0, 2.0, 3.0 ) ~-2.792 > y = {{alias}}( 2.5, 2.0, 3.0 ) ~-1.958 > y = {{alias}}( NaN, 0.0, 1.0 ) NaN > y = {{alias}}( 0.0, NaN, 1.0 ) NaN > y = {{alias}}( 0.0, 0.0, NaN ) NaN // Negative scale parameter: > y = {{alias}}( 2.0, 0.0, -1.0 ) NaN {{alias}}.factory( μ, b ) Returns a function for evaluating the logarithm of the probability density function (PDF) of a Laplace distribution with scale parameter `b` and location parameter `μ`. Parameters ---------- μ: number Location parameter. b: number Scale parameter. Returns ------- logpdf: Function Logarithm of probability density function (PDF). Examples -------- > var mylogPDF = {{alias}}.factory( 10.0, 2.0 ); > var y = mylogPDF( 10.0 ) ~-1.386 See Also --------