Generate Multinomial Random Variables with Varying Probabilities
Generate Multinomial Random Variables with Varying Probabilities
Given a matrix of multinomial probabilities where rows correspond to observations and columns to categories (and each row sums to 1), generates a matrix with the same number of rows as has probs and with m columns. The columns represent multinomial cell numbers, and within a row the columns are all samples from the same multinomial distribution. The code is a modification of that in the impute.polyreg function in the MICE package.