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

◆ laplace_latent_tol_poisson_log_rng()

template<typename Mean , typename CovarFun , typename CovarArgs , typename OpsTuple , typename RNG >
Eigen::VectorXd stan::math::laplace_latent_tol_poisson_log_rng ( const std::vector< int > &  y,
const std::vector< int > &  y_index,
Mean &&  mean,
CovarFun &&  covariance_function,
CovarArgs &&  covar_args,
OpsTuple &&  ops,
RNG &  rng,
std::ostream *  msgs 
)
inline

In a latent gaussian model,.

theta ~ Normal(0, Sigma(phi)) y ~ p(y|theta,phi)

return a sample from the Laplace approximation to p(theta|y,phi). The Laplace approximation is computed using a Newton solver. In this specialized function, the likelihood p(y|theta) is a

Template Parameters
ThetaVecA type inheriting from Eigen::EigenBase with dynamic sized rows and 1 column.
Meantype of the mean of the latent normal distribution
CovarFunA 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.
CovarArgsA tuple of types to passed as the first arguments of CovarFun::operator()
OpsTupleA tuple of laplace_options types
RNGA valid boost rng type
Parameters
[in]yObserved counts.
[in]y_indexIndex indicating which group each observation belongs to.
[in]meanThe mean of the latent normal variable.
[in]covariance_functiona function which returns the prior covariance.
[in]covar_argsarguments for the covariance function.
[in]opsOptions 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]rngRandom number generator
[in,out]msgsstream for messages from likelihood and covariance

Definition at line 35 of file laplace_latent_poisson_log_rng.hpp.