Update psis_loo_ss objects
Arguments
- object
A
psis_loo_ssobject to update.- ...
Currently not used.
- data, draws
- observations
The subsample observations to use. The argument can take four (4) types of arguments:
NULLto use all observations. The algorithm then just uses standardloo()orloo_approximate_posterior().A single integer to specify the number of observations to be subsampled.
A vector of integers to provide the indices used to subset the data. These observations need to be subsampled with the same scheme as given by the
estimatorargument.A
psis_loo_ssobject to use the same observations that were used in a previous call toloo_subsample().
- r_eff
Vector of relative effective sample size estimates for the likelihood (
exp(log_lik)) of each observation. This is related to the relative efficiency of estimating the normalizing term in self-normalized importance sampling when using posterior draws obtained with MCMC. If MCMC draws are used andr_effis not provided then the reported PSIS effective sample sizes and Monte Carlo error estimates can be over-optimistic. If the posterior draws are (near) independent thenr_eff=1can be used.r_effhas to be a scalar (same value is used for all observations) or a vector with length equal to the number of observations. The default value is 1. See therelative_eff()helper functions for help computingr_eff.- cores
The number of cores to use for parallelization. This defaults to the option
mc.coreswhich can be set for an entire R session byoptions(mc.cores = NUMBER). The old optionloo.coresis now deprecated but will be given precedence overmc.coresuntilloo.coresis removed in a future release. As of version 2.0.0 the default is now 1 core ifmc.coresis 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
.Rprofilefile to setmc.cores(using thecoresargument or settingmc.coresinteractively or in a script is fine).
- loo_approximation
What type of approximation of the loo_i's should be used? The default is
"plpd"(the log predictive density using the posterior expectation). There are six different methods implemented to approximate loo_i's (see the references for more details):"plpd": uses the lpd based on point estimates (i.e., \(p(y_i|\hat{\theta})\))."lpd": uses the lpds (i,e., \(p(y_i|y)\))."tis": uses truncated importance sampling to approximate PSIS-LOO."waic": uses waic (i.e., \(p(y_i|y) - p_{waic}\))."waic_grad_marginal": uses waic approximation using first order delta method and posterior marginal variances to approximate \(p_{waic}\) (ie. \(p(y_i|\hat{\theta})\)-p_waic_grad_marginal). Requires gradient of likelihood function."waic_grad": uses waic approximation using first order delta method and posterior covariance to approximate \(p_{waic}\) (ie. \(p(y_i|\hat{\theta})\)-p_waic_grad). Requires gradient of likelihood function."waic_hess": uses waic approximation using second order delta method and posterior covariance to approximate \(p_{waic}\) (ie. \(p(y_i|\hat{\theta})\)-p_waic_grad). Requires gradient and Hessian of likelihood function.
As point estimates of \(\hat{\theta}\), the posterior expectations of the parameters are used.
- loo_approximation_draws
The number of posterior draws used when integrating over the posterior. This is used if
loo_approximationis set to"lpd","waic", or"tis".- llgrad
The gradient of the log-likelihood. This is only used when
loo_approximationis"waic_grad","waic_grad_marginal", or"waic_hess". The default isNULL.- llhess
The Hessian of the log-likelihood. This is only used with
loo_approximation = "waic_hess". The default isNULL.
Details
If observations is updated then if a vector of indices or a psis_loo_ss
object is supplied the updated object will have exactly the observations
indicated by the vector or psis_loo_ss object. If a single integer is
supplied, new observations will be sampled to reach the supplied sample size.