powered by
Draw random samples from multiple Dirichlet distributions. rdirichlet_mat is vectorized and written in C++ for speed.
rdirichlet_mat
rdirichlet_mat(n, alpha)
Number of samples to draw.
A matrix where each row is a separate vector of shape parameters.
An array of matrices where each row of each matrix is a sample from the Dirichlet distribution.
This function is particularly useful for representing the distribution of transition probabilities in a transition matrix.
# NOT RUN { alpha <- matrix(c(100, 200, 500, 50, 70, 75), ncol = 3, nrow = 2, byrow = TRUE) samp <- rdirichlet_mat(100, alpha) print(samp[, , 1:2]) # }
Run the code above in your browser using DataLab