Skip to content

Commit

Permalink
Merge branch 'new-pareto-k-threshold' of github.com:stan-dev/loo into…
Browse files Browse the repository at this point in the history
… new-pareto-k-threshold
  • Loading branch information
avehtari committed Jan 28, 2024
2 parents 57e9061 + 955b4d5 commit 77793cd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions R/diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@
#' improve the ratio ESS/S.
#'
#' * If \eqn{k < min(1 - 1 / log10(S), 0.7)}, where \eqn{S} is the
#' sample size, PSIS estimate and the corresponding Monte Carlo
#' sample size, the PSIS estimate and the corresponding Monte Carlo
#' standard error estimate are reliable.
#'
#' * If \eqn{1 - 1 / log10(S) <= k < 0.7}, PSIS estimate and the
#' corresponding Monte Carlo standard error estimate are not
#' reliable, but increasing (effective) sample size \eqn{S} above
#' reliable, but increasing the (effective) sample size \eqn{S} above
#' 2200 may help (this will increase the sample size specific
#' threshold \eqn{(1-1/log10(2200)>0.7} and then the bias specific
#' threshold 0.7 dominates).
#'
#' * If \eqn{0.7 <= k < 1}, PSIS estimate and the corresponding Monte
#' * If \eqn{0.7 <= k < 1}, the PSIS estimate and the corresponding Monte
#' Carlo standard error have large bias and are not reliable. Increasing
#' sample size may reduce the uncertainty in \eqn{k} estimate.
#' the sample size may reduce the uncertainty in the \eqn{k} estimate.
#'
#' * If \eqn{0.7 <= k < 1}, PSIS estimate and the corresponding Monte
#' Carlo standard error have large bias and are not reliable. Increasing
#' sample size may reduce the variability in \eqn{k} estimate, which
#' may result in lower \eqn{k} estimate, too.
#'
#' * If \eqn{k \geq 1}{k >= 1}, the target distribution is estimated to
#' have non-finite mean. PSIS estimate and the corresponding Monte
#' Carlo standard error are not well defined. Increasing sample size
#' have non-finite mean. The PSIS estimate and the corresponding Monte
#' Carlo standard error are not well defined. Increasing the sample size
#' may reduce the variability in \eqn{k} estimate, which
#' may result in lower \eqn{k} estimate, too.
#'
Expand Down Expand Up @@ -253,7 +253,7 @@ mcse_loo <- function(x, threshold = NULL) {
#' and can be used to control the appearance of the labels.
#' @param diagnostic For the `plot` method, which diagnostic should be
#' plotted? The options are `"k"` for Pareto \eqn{k} estimates (the
#' default) or `"ESS"` (`"n_eff"`) for PSIS effective sample size estimates.
#' default), or `"ESS"` or `"n_eff"` for PSIS effective sample size estimates.
#' @param main For the `plot()` method, a title for the plot.
#'
#' @return The `plot()` method is called for its side effect and does not
Expand All @@ -276,7 +276,7 @@ plot.psis_loo <- function(x,
"% of Pareto k estimates are Inf/NA/NaN and not plotted.")
}

if (diagnostic == "ESS" | diagnostic == "n_eff") {
if (diagnostic == "ESS" || diagnostic == "n_eff") {
n_eff <- psis_n_eff_values(x)
} else {
n_eff <- NULL
Expand Down

0 comments on commit 77793cd

Please sign in to comment.