PSIS {causalOT} | R Documentation |
Pareto-Smoothed Importance Sampling
Description
Pareto-Smoothed Importance Sampling
Usage
PSIS(x, r_eff = NULL, ...)
## S4 method for signature 'numeric'
PSIS(x, r_eff = NULL, ...)
## S4 method for signature 'causalWeights'
PSIS(x, r_eff = NULL, ...)
## S4 method for signature 'list'
PSIS(x, r_eff = NULL, ...)
PSIS_diag(x, ...)
## S4 method for signature 'numeric'
PSIS_diag(x, r_eff = NULL)
## S4 method for signature 'causalWeights'
PSIS_diag(x, r_eff = NULL)
## S4 method for signature 'causalPSIS'
PSIS_diag(x, ...)
## S4 method for signature 'list'
PSIS_diag(x, r_eff = NULL)
## S4 method for signature 'psis'
PSIS_diag(x, r_eff = NULL)
Arguments
x |
For |
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 |
... |
Arguments passed to the 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.
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".
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
See Also
Examples
x <- runif(100)
w <- x/sum(x)
res <- PSIS(x = w, r_eff = 1)
PSIS_diag(res)