psis_approximate_posterior {loo} | R Documentation |
Diagnostics for Laplace and ADVI approximations and Laplace-loo and ADVI-loo
Description
Diagnostics for Laplace and ADVI approximations and Laplace-loo and ADVI-loo
Usage
psis_approximate_posterior(log_p, log_q, log_liks = NULL, cores,
save_psis, ...)
Arguments
log_p |
The log-posterior (target) evaluated at S samples from the
proposal distribution (q). A vector of length S.
|
log_q |
The log-density (proposal) evaluated at S samples from the
proposal distribution (q). A vector of length S.
|
log_liks |
A log-likelihood matrix of size S * N, where N is the number
of observations and S is the number of samples from q. See
loo.matrix for details. Default is NULL . Then only the
posterior is evaluated using the k_hat diagnostic.
|
cores |
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 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).
|
save_psis |
Should the "psis" object created internally by
loo be saved in the returned object? The loo function calls
psis internally but by default discards the (potentially
large) "psis" object after using it to compute the LOO-CV summaries.
Setting save_psis to TRUE will add a psis_object
component to the list returned by loo . Currently this is only needed
if you plan to use the E_loo function to compute weighted
expectations after running loo .
|
... |
For the loo function method and the loo_i
function, the data, posterior draws, and other arguments to pass to the
log-likelihood function. See the Methods (by class) section below
for details on how to specify these arguments.
|
Value
If log likelihoods are supplied, the function returns a loo
object,
otherwise the function returns a psis
object.
References
Vehtari, A., Gelman, A., and Gabry, J. (2017a). Practical
Bayesian model evaluation using leave-one-out cross-validation and WAIC.
Statistics and Computing. 27(5), 1413–1432.
doi:10.1007/s11222-016-9696-4.
(
journal, preprint arXiv:1507.04544).
Vehtari, A., Gelman, A., and Gabry, J. (2017b). Pareto smoothed
importance sampling. arXiv preprint: http://arxiv.org/abs/1507.02646/
See Also
loo
and psis
[Package
loo version 2.1.0
Index]