A function that computes the split moment matching importance sampling loo. Takes in the moment matching total transformation, transforms only half of the draws, and computes a single elpd using multiple importance sampling.
loo_moment_match_split(
x,
upars,
cov,
total_shift,
total_scaling,
total_mapping,
i,
log_prob_upars,
log_lik_i_upars,
r_eff_i,
cores,
is_method,
...
)A fitted model object.
A matrix containing the model parameters in unconstrained space where they can have any real value.
Logical; Indicate whether to match the covariance matrix of the
samples or not. If FALSE, only the mean and marginal variances are
matched.
A vector representing the total shift made by the moment matching algorithm.
A vector representing the total scaling of marginal variance made by the moment matching algorithm.
A vector representing the total covariance transformation made by the moment matching algorithm.
Observation index.
A function that takes arguments x and upars and
returns a matrix of log-posterior density values of the unconstrained
posterior draws passed via upars.
A function that takes arguments x, upars, and i
and returns a vector of log-likeliood draws of the ith observation based
on the unconstrained posterior draws passed via upars.
MCMC relative effective sample size of the i'th log
likelihood draws.
The number of cores to use for parallelization. This defaults to
the option mc.cores which can be set for an entire R session by
options(mc.cores = NUMBER). The old option loo.cores is now
deprecated but will be given precedence over mc.cores until
loo.cores is removed in a future release. As of version
2.0.0 the default is now 1 core if mc.cores is not set, but we
recommend using as many (or close to as many) cores as possible.
Note for Windows 10 users: it is strongly
recommended to avoid using
the .Rprofile file to set mc.cores (using the cores argument or
setting mc.cores interactively or in a script is fine).
The importance sampling method to use. The following methods are implemented:
Further arguments passed to the custom functions documented above.
A list containing the updated log-importance weights and log-likelihood values. Also returns the updated MCMC effective sample size and the integrand-specific log-importance weights.
Paananen, T., Piironen, J., Buerkner, P.-C., Vehtari, A. (2020). Implicitly Adaptive Importance Sampling. preprint arXiv:1906.08850