The OpenD Programming Language

gammaLPDF

Computes the gamma log probability density function (LPDF).

shape values less than 1 are supported when it is a floating point type.

If shape is passed as a size_t type (or a type convertible to that), then the LPDF is calculated using the relationship with the poisson distribution (i.e. replacing the logGamma function with the logFactorial).

  1. T gammaLPDF(T x, T shape, T scale)
    @safe pure nothrow @nogc
    T
    gammaLPDF
    (
    T
    )
    (
    const T x
    ,
    const T shape
    ,
    const T scale = 1
    )
    if (
    isFloatingPoint!T
    )
  2. T gammaLPDF(T x, size_t shape, T scale)

Parameters

x T

value to evaluate LPDF

shape T

shape parameter

scale T

scale parameter

Examples

import mir.test: shouldApprox;

2.0.gammaLPDF(3.0).shouldApprox == -1.306853;
2.0.gammaLPDF(3.0, 4.0).shouldApprox == -3.965736;
// Calling with `size_t` uses log factorial function instead of log gamma,
// but produces same results
2.0.gammaLPDF(3).shouldApprox == 2.0.gammaLPDF(3.0);
2.0.gammaLPDF(3, 4.0).shouldApprox == 2.0.gammaLPDF(3.0, 4.0);

See Also

Meta