sample_stochastic_matrix: Sample a stochastic matrix

View source: R/utils.R

sample_stochastic_matrixR Documentation

Sample a stochastic matrix

Description

x is a matrix with arbitrary number of rows but whose columns are equal to the number of bins that the stochastic matrix prob parameterizes a distribution over. Each row of x gives a distribution of counts over bins and is resampled according to prob. It is conceptually similar to "stochastically" distributing the matrix as x %*% prob, which gives the expectation.

Usage

sample_stochastic_matrix(x, prob)

Arguments

x

a matrix

prob

a matrix, it must have number of columns equal to the number of columns of x and rows that sum to one

Value

a matrix whose dimensions equal the original x


MicroMoB documentation built on Jan. 17, 2023, 9:06 a.m.