![]() |
Stan Math Library
5.2.0
Automatic Differentiation
|
|
inline |
Wrapper function around the laplace_marginal_density function.
Returns the marginal density p(y|phi) by marginalizing out the latent gaussian variable theta, with a Laplace approximation. See the laplace_marginal function for more details. The data y is assumed to be real. The function is "overloaded" below for the int y and lpmf case.
| propto | If FALSE, log density is computed up to an additive const. |
| LFun | The function which returns the log likelihood. |
| LArgs | A tuple of arguments to the log likelihood. |
| EtaVec | The type of the parameter arguments for the likelihood fn. |
| 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() |
| OpsTuple | A tuple of laplace_options types |
| [in] | L_f | a function which returns the log likelihood. |
| [in] | l_args | A tuple of arguments to pass to the log likelihood. |
| [in] | covariance_function | a function which returns the prior covariance. |
| [in] | covar_args | arguments for the covariance function. |
| [in] | ops | Options for controlling Laplace approximation. The following options are available: - theta_0 the initial guess for the Laplace approximation. - tolerance controls the convergence criterion when finding the mode in the Laplace approximation. - max_num_steps maximum number of steps before the Newton solver breaks and returns an error. - hessian_block_size Block size of Hessian of log likelihood w.r.t latent Gaussian variable theta. - solver Type of Newton solver. Each corresponds to a distinct choice of B matrix (i.e. application SWM formula): 1. computes square-root of negative Hessian. 2. computes square-root of covariance matrix. 3. computes no square-root and uses LU decomposition. - max_steps_line_search Number of steps after which the algorithm gives up on doing a line search. If 0, no linesearch. - allow_fallthrough If true, if solver 1 fails then solver 2 is tried, and if that fails solver 3 is tried. |
| [in,out] | msgs | stream for messages from likelihood and covariance |
Definition at line 30 of file laplace_marginal.hpp.