View source: R/MLE_dirichlet.R
MLE_dirichlet | R Documentation |
The function MLE_dirichlet
performs a maximum-likelihood estimation of the
\alpha
parameter of a Dirichlet distribution for a given sample of
probability vectors.
MLE_dirichlet(probs, alpha0 = rep(1, ncol(probs)))
probs |
a matrix with N rows representing observations of probability vectors and K columns representing the classes. Therefore, values of each row should sum to 1. |
alpha0 |
vector of K=ncol(probs) values as starting parameter for the optimization. Values have to be greater 0. |
The density of the Dirichlet distribution for
\alpha = (\alpha_1, ..., \alpha_K )
and
\alpha_i > 0 \forall i=1,...,K
is given by
f(p|\alpha)=\frac{1}{B(\alpha)} \prod_{i=1}{K} p_{i}^{\alpha_i - 1},
if 0\leq p_i \leq 1 \forall i = 1,...,K
and \sum_{i=1}^{K} p_i ) 1
,
and f(p|\alpha) = 0
, else.
The function optimizes the log-likelihood of a sample of probability vectors
given in probs
using the function optim
and a Nelder-Mead
algorithm.
Returns a numeric vector of length K=ncol(probs) representing the
\alpha
of the Dirichlet distribution.
Sebastian Hellmann.
probs <- matrix(c(0.2, 0.4, 0.2, 0.4, 0, 0.2, 0.4, 0.4, 0.6, 0.2, 0.2,
0.4, 0.4, 0.2, 0.2, 0.4, 0.8, 0.4), ncol=3)
MLE_dirichlet(probs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.