![]() |
Stan Math Library
5.4.0
Automatic Differentiation
|
|
inline |
Categorical log PMF in log-odds parametrization, summed over an array of outcomes.
Categorical(ns | softmax(beta))
Entries of beta equal to -inf have zero probability; if any entries are +inf, probability is split evenly among them. These are the limits of softmax: as beta[n] -> -inf, softmax(beta)[n] -> 0, and if k entries -> +inf at the same rate, each has probability 1/k.
If ns is empty the log probability is 0; in that case beta may also be empty.
| ns | Array of outcomes, each in 1:size(beta) |
| beta | Vector of log odds (unnormalized log probabilities) |
| std::domain_error | if any element of ns is not in 1:size(beta) |
| std::domain_error | if beta contains NaN |
| std::domain_error | if beta is non-empty and every entry of beta is negative infinity |
| std::domain_error | if beta is an autodiff (var) type and contains any non-finite value |
Definition at line 96 of file categorical_logit_lpmf.hpp.