Stan Math Library
4.9.0
Automatic Differentiation
|
|
inline |
Return the log mixture density with specified mixing proportion and log densities and its derivative at each.
\[ \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \log \left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right). \]
\[ \frac{\partial}{\partial \theta} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\exp(\lambda_1) - \exp(\lambda_2)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]
\[ \frac{\partial}{\partial \lambda_1} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\theta \exp(\lambda_1)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]
\[ \frac{\partial}{\partial \lambda_2} \mbox{log\_mix}(\theta, \lambda_1, \lambda_2) = \dfrac{\theta \exp(\lambda_2)} {\left( \theta \exp(\lambda_1) + (1 - \theta) \exp(\lambda_2) \right)} \]
T_theta | theta scalar type. |
T_lambda1 | lambda1 scalar type. |
T_lambda2 | lambda2 scalar type. |
[in] | theta | mixing proportion in [0, 1]. |
[in] | lambda1 | first log density. |
[in] | lambda2 | second log density. |
Definition at line 78 of file log_mix.hpp.