Learn R Programming

causalOT (version 1.0.2)

PSIS: Pareto-Smoothed Importance Sampling

Description

Pareto-Smoothed Importance Sampling

Usage

PSIS(x, r_eff = NULL, ...)

# S4 method for numeric PSIS(x, r_eff = NULL, ...)

# S4 method for causalWeights PSIS(x, r_eff = NULL, ...)

# S4 method for list PSIS(x, r_eff = NULL, ...)

PSIS_diag(x, ...)

# S4 method for numeric PSIS_diag(x, r_eff = NULL)

# S4 method for causalWeights PSIS_diag(x, r_eff = NULL)

# S4 method for causalPSIS PSIS_diag(x, ...)

# S4 method for list PSIS_diag(x, r_eff = NULL)

# S4 method for psis PSIS_diag(x, r_eff = NULL)

Value

For PSIS(), returns a list. See psis() from loo for a description of the outputs. Will give the log of the smoothed weights in slot log_weights, and in the slot diagnostics, it will give the pareto_k parameter (see the pareto-k-diagnostic page) and the n_eff estimates. PSIS_diag() returns the diagnostic slot from an object of class "psis".

Arguments

x

For PSIS(), a vector of weights, an object of class causalWeights, or a list with slots "w0" and "w1". For PSIS_diag, the results of a run of PSIS().

r_eff

A vector of relative effective sample size with one estimate per observation. If providing an object of class causalWeights, should be a list of vectors with one vector for each sample. See psis() from the loo package for more details. Updates to the loo package now make it so this parameter should be ignored.

...

Arguments passed to the psis() function.

Methods (by class)

  • PSIS(numeric): numeric weights

  • PSIS(causalWeights): object of class causalWeights

  • PSIS(list): list of weights

  • PSIS_diag(numeric): numeric weights

  • PSIS_diag(causalWeights): object of class causalWeights diagnostics

  • PSIS_diag(causalPSIS): diagnostics from the output of a previous call to PSIS

  • PSIS_diag(list): a list of objects

  • PSIS_diag(psis): output of PSIS function

Details

Acts as a wrapper to the psis() function from the loo package. It is built to handle the data types found in this package. This method is preferred to the ESS() function in causalOT since the latter is prone to error (infinite variances) but will not give good any indication that the estimates are problematic.

See Also

ESS()

Examples

Run this code
x <- runif(100)
w <- x/sum(x)

res <- PSIS(x = w, r_eff = 1)
PSIS_diag(res)

Run the code above in your browser using DataLab