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 rows sum to one. For each row, performs a single multinomial draw from amongst the columns, weighted by their values in that column

Usage

samp_from_mat(M)

Arguments

M

a matrix whose rows are reals, each summing to one

Value

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


eriqande/CKMRsim documentation built on Aug. 2, 2024, 7:23 a.m.