![]() |
Stan Math Library
5.1.0
Automatic Differentiation
|
|
inline |
For a latent Gaussian model with hyperparameters phi and latent variables theta, and observations y, this function computes an approximation of the log marginal density, p(y | phi).
This is done by marginalizing out theta, using a Laplace approxmation. The latter is obtained by finding the mode, via Newton's method, and computing the Hessian of the likelihood.
The convergence criterion for the Newton is a small change in log marginal density. The user controls the tolerance (i.e. threshold under which change is deemed small enough) and maximum number of steps.
A description of this algorithm can be found in:
Variables needed for the gradient or generating quantities are stored by reference.
LLFun | Type with a valid operator(ThetaVec, InnerLLTupleArgs) where InnerLLTupleArgs are the elements of LLTupleArgs |
LLTupleArgs | A tuple whose elements follow the types required for LLFun |
ThetaVec | A type inheriting from Eigen::EigenBase with dynamic sized rows and 1 column. |
CovarFun | A functor with an operator()(CovarArgsElements..., {TrainTupleElements...| PredTupleElements...}) method. The operator() method should accept as arguments the inner elements of CovarArgs . The return type of the operator() method should be a type inheriting from Eigen::EigenBase with dynamic sized rows and columns. |
CovarArgs | A tuple of types to passed as the first arguments of CovarFun::operator() |
[in] | ll_fun | A log likelihood functor |
[in] | ll_args | Tuple containing parameters for LLFun |
[in] | theta_0 | the initial guess for the Laplace approximation. |
[in] | covariance_function | a function which returns the prior covariance. |
[in] | covar_args | arguments for the covariance function. |
[in] | options | A set of options for tuning the solver |
[in,out] | msgs | stream for messages from likelihood and covariance |
Definition at line 454 of file laplace_marginal_density.hpp.