This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / stats / _multivariate / random_table_gen / logpmf

function

scipy.stats._multivariate:random_table_gen.logpmf

source: build-install/usr/lib/python3.14/site-packages/scipy/stats/_multivariate.py:6181

Signature

def logpmf(self, x, row, col)

Summary

Log-probability of table to occur in the distribution.

Parameters

x : array-like

Two-dimensional table of non-negative integers, or a multi-dimensional array with the last two dimensions corresponding with the tables.

row : array_like

Sum of table entries in each row.

col : array_like

Sum of table entries in each column.

Returns

logpmf : ndarray or scalar

Log of the probability mass function evaluated at x.

Notes

The row and column vectors must be one-dimensional, not empty, and each sum up to the same value. They cannot contain negative or noninteger entries.

If row and column marginals of x do not match row and col, negative infinity is returned.

Examples

from scipy.stats import random_table
import numpy as np
✓
x = [[1, 5, 1], [2, 3, 1]]
row = np.sum(x, axis=1)
col = np.sum(x, axis=0)
✓
random_table.logpmf(x, row, col)
✗
np.float64(-1.6306401200847027)
Alternatively, the object may be called (as a function) to fix the row and column vector sums, returning a "frozen" distribution.
d = random_table(row, col)
✓
d.logpmf(x)
✗
np.float64(-1.6306401200847027)

Aliases

  • scipy.stats._multivariate.random_table_gen.logpmf