importance_sampling.default: Importance sampling (default)

View source: R/importance_sampling.R

importance_sampling.defaultR Documentation

Importance sampling (default)

Description

Importance sampling (default)

Usage

## Default S3 method:
importance_sampling(log_ratios, method, ..., r_eff = NULL)

Arguments

log_ratios

An array, matrix, or vector of importance ratios on the log scale (for PSIS-LOO these are negative log-likelihood values). See the Methods (by class) section below for a detailed description of how to specify the inputs for each method.

...

Arguments passed on to the various methods.

r_eff

Vector of relative effective sample size estimates containing one element per observation. The values provided should be the relative effective sample sizes of 1/exp(log_ratios) (i.e., 1/ratios). This is related to the relative efficiency of estimating the normalizing term in self-normalizing importance sampling. If r_eff is not provided then the reported PSIS effective sample sizes and Monte Carlo error estimates will be over-optimistic. See the relative_eff() helper function for computing r_eff. If using psis with draws of the log_ratios not obtained from MCMC then the warning message thrown when not specifying r_eff can be disabled by setting r_eff to NA.

is_method

The importance sampling method to use. The following methods are implemented:

  • "psis": Pareto-Smoothed Importance Sampling (PSIS). Default method.

  • "tis": Truncated Importance Sampling (TIS) with truncation at sqrt(S), where S is the number of posterior draws.

  • "sis": Standard Importance Sampling (SIS).


loo documentation built on March 31, 2023, 10:11 p.m.