bundles / scipy 1.18.0 / scipy / stats / _multivariate / random_table_gen / rvs
function
scipy.stats._multivariate:random_table_gen.rvs
Signature
def rvs(self, row, col, *, size = None, method = None, random_state = None)Summary
Draw random tables with fixed column and row marginals.
Parameters
row: array_likeSum of table entries in each row.
col: array_likeSum of table entries in each column.
size: int, optionalNumber of samples to draw (default 1).
method: str, optionalWhich method to use, "boyett" or "patefield". If None (default), selects the fastest method for this input.
seed: {None, int, np.random.RandomState, np.random.Generator}, optionalUsed for drawing random variates. If seed is None, the
~np.random.RandomStatesingleton is used. If seed is an int, a newRandomStateinstance is used, seeded with seed. If seed is already aRandomStateorGeneratorinstance, then that object is used. Default is None.
Returns
rvs: ndarrayRandom 2D tables of shape (
size,len(row),len(col)).
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.
Examples
from scipy.stats import random_table
✓row = [1, 5] col = [2, 3, 1]✓
random_table.rvs(row, col, random_state=123)
✗array([[1, 0, 0],
[1, 3, 1]])
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.rvs(random_state=123)
✗array([[1, 0, 0],
[1, 3, 1]])
Aliases
scipy.stats._multivariate.random_table_gen.rvs