samp_from_mat: Sample 1 observation from cell probabilities that are columns...

View source: R/RcppExports.R

samp_from_matR Documentation

Sample 1 observation from cell probabilities that are columns of a matrix

Description

Takes a matrix in which columns sum to one. For each column, performs a single multinomial draw from the rows, weighted by their values in that column

Usage

samp_from_mat(M)

Arguments

M

a matrix whose columns are reals summing to one

Value

a vector length = ncol(M) of indices, with each element being the row that was chosen in that column's sampling


benmoran11/rubias documentation built on Feb. 1, 2024, 10:52 p.m.