rStats.js v1.3.0
    Preparing search index...

    Function dmultinom

    • Probability function of the multinomial distribution. Equivalent to R's dmultinom(x, size = NULL, prob, log = FALSE).

      Parameters

      • x: readonly number[]

        Counts, a vector of K non-negative integers.

      • prob: readonly number[]

        Category weights, K finite non-negative numbers, not all 0 (divided by their sum).

      • options: MultinomialOptions = {}

        size and log (see MultinomialOptions).

      Returns number

      The probability N! / (x_1! ... x_K!) prod p_j^x_j with N = sum(x), or its log.

      RangeError if x and prob differ in length, x has a negative or non-integer value, prob has a negative or non-finite value or no positive value, or size differs from the sum of x.

      dmultinom([1, 2, 1], [0.2, 0.5, 0.3]);  // 0.18000000000000002