| ddirichlet_cpp | R Documentation |
The function ddirichlet() computes the density of a Dirichlet distribution.
The function rdirichlet() samples from a Dirichlet distribution.
The functions with suffix _cpp perform no input checks, hence are faster.
ddirichlet_cpp(x, concentration, log = FALSE)
rdirichlet_cpp(concentration)
ddirichlet(x, concentration, log = FALSE)
rdirichlet(n = 1, concentration)
x |
[ |
concentration |
[ |
log |
[ |
n |
[ |
For ddirichlet(): The density value.
For rdirichlet(): If n = 1 a vector of length p, else
a matrix of dimension n times p with samples as rows.
Other simulation helpers:
Simulator,
correlated_regressors(),
dmixnorm_cpp(),
dmvnorm_cpp(),
dtnorm_cpp(),
dwishart_cpp(),
gaussian_tv(),
simulate_markov_chain()
x <- c(0.5, 0.3, 0.2)
concentration <- 1:3
# compute density
ddirichlet(x = x, concentration = concentration)
ddirichlet(x = x, concentration = concentration, log = TRUE)
# sample
rdirichlet(concentration = 1:3)
rdirichlet(n = 4, concentration = 1:2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.