| mexpit | R Documentation |
This function converts log-scale numbers to probabilities.
mexpit(...)
dmexpit(...)
... |
numeric log-scale numbers to convert to probabilities. |
The probabilities are calculated using the following equation:
p_i = \frac{e^{x_i}}{1+\sum_{j=1}^{N-1} e^{x_j}}
This ensures one remaining probability will add to one, that is
p_N = \frac{1}{1+\sum_{j=1}^{N-1} e^{x_j}}
For the function dmexpit(), the element-wise derivatives are calculated; that is, it returns the diagonal of the Jacobian matrix, d p_i / d x_i, not the full Jacobian with off-diagonal terms.
Probabilities that add up to a number less than 1.
Matthew L. Fidler
m <- mlogit(0.1, 0.2, 0.3)
mexpit(m)
# derivatives
dmexpit(m)
p <- mexpit(-3, 0.5, 3)
mlogit(p)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.