Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ categorical_logit_lpmf() [1/3]

template<bool propto, typename T_prob , require_col_vector_t< T_prob > * = nullptr>
return_type_t< T_prob > stan::math::categorical_logit_lpmf ( int  n,
const T_prob &  beta 
)
inline

Categorical log PMF in log-odds parametrization.

Categorical(n | 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.

Parameters
nOutcome, in 1:size(beta)
betaVector of log odds (unnormalized log probabilities)
Returns
log probability of the outcome
Exceptions
std::domain_errorif n is not in 1:size(beta)
std::domain_errorif beta contains NaN
std::domain_errorif every entry of beta is negative infinity
std::domain_errorif beta is an autodiff (var) type and contains any non-finite value

Definition at line 36 of file categorical_logit_lpmf.hpp.