View source: R/distributions.R
rDirichlet | R Documentation |
Simulates from the Dirichlet distribution.
rDirichlet(n, alpha)
n |
number of draws |
alpha |
vector with hyperparameters |
n-by-p matrix where each row is a draw.
library(bayeslearn) draws = rDirichlet(n = 1000, alpha = c(3,5,10)) colMeans(draws) # Close to theoretical c(3,5,10)/18 = 0.167 0.278 0.556
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.