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

◆ laplace_base_rng()

template<typename LLFunc , typename LLArgs , typename CovarFun , typename CovarArgs , bool InitTheta, typename RNG , require_t< is_all_arithmetic_scalar< CovarArgs, LLArgs > > * = nullptr>
Eigen::VectorXd stan::math::laplace_base_rng ( LLFunc &&  ll_fun,
LLArgs &&  ll_args,
CovarFun &&  covariance_function,
CovarArgs &&  covar_args,
const laplace_options< InitTheta > &  options,
RNG &  rng,
std::ostream *  msgs 
)
inline

In a latent gaussian model,.

theta ~ Normal(theta | 0, Sigma(phi, x)) y ~ pi(y | theta, eta)

returns a multivariate normal random variate sampled from the Laplace approximation of p(theta_pred | y, phi, x_pred). Note that while the data is observed at x (train_tuple), the new samples are drawn for covariates x_pred (pred_tuple). To sample the "original" theta's, set pred_tuple = train_tuple.

Template Parameters
LLFuncType of likelihood function.
LLArgsTuple of arguments types of likelihood function.
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()
RNGA valid boost rng type
Parameters
ll_funLikelihood function.
ll_argsArguments for likelihood function.
[in]covariance_functiona function which returns the prior covariance.
[in]covar_argsarguments for the covariance function.
optionsControl parameter for optimizer underlying Laplace approx.
[in,out]rngRandom number generator
[in,out]msgsstream for messages from likelihood and covariance

Definition at line 37 of file laplace_base_rng.hpp.