Skip to content

Commit 3b6faf8

Browse files
authored
Merge pull request #266 from stan-dev/update-psis-ref
update psis ref + some minor typo fixes
2 parents 9f28fc4 + f25aeb0 commit 3b6faf8

24 files changed

+61
-75
lines changed

R/loo_moment_matching.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ loo_moment_match.default <- function(x, loo, post_draws, log_lik_i,
195195
#' @param i observation number.
196196
#' @param x A fitted model object.
197197
#' @param log_lik_i A function that takes `x` and `i` and returns a matrix (one
198-
#' column per chain) or a vector (all chains stacked) of log-likeliood draws
198+
#' column per chain) or a vector (all chains stacked) of log-likelihood draws
199199
#' of the `i`th observation based on the model `x`. If the draws are obtained
200200
#' using MCMC, the matrix with MCMC chains separated is preferred.
201201
#' @param unconstrain_pars A function that takes arguments `x`, and `pars` and
@@ -440,7 +440,7 @@ loo_moment_match_i <- function(i,
440440
#' `upars` and returns a matrix of log-posterior density values of the
441441
#' unconstrained posterior draws passed via `upars`.
442442
#' @param log_lik_i_upars A function that takes arguments `x`, `upars`,
443-
#' and `i` and returns a vector of log-likeliood draws of the `i`th
443+
#' and `i` and returns a vector of log-likelihood draws of the `i`th
444444
#' observation based on the unconstrained posterior draws passed via
445445
#' `upars`.
446446
#' @param r_eff_i MCMC effective sample size divided by the total sample size

R/loo_subsample.R

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ update.psis_loo_ss <- function(object, ...,
316316
stopifnot(is.data.frame(data) || is.matrix(data) & !is.null(draws))
317317
}
318318

319-
# Compute subsample indecies
319+
# Compute subsample indices
320320
if (length(observations) > 1) {
321321
idxs <- compute_idxs(observations)
322322
} else {
@@ -448,7 +448,7 @@ nobs.psis_loo_ss <- function(object, ...) {
448448
#' @details
449449
#' The choice `psis` is returned if a `psis_loo` object
450450
#' is converted to a `psis_loo_ss` object with `as.psis_loo_ss()`.
451-
#' But `psis` cannot be chosen in the api of `loo_subsample()`.
451+
#' But `psis` cannot be chosen in the API of `loo_subsample()`.
452452
#'
453453
#' @noRd
454454
#' @param api The choices available in the loo API or all possible choices.
@@ -756,7 +756,7 @@ compute_idxs <- function(observations) {
756756
}
757757

758758

759-
#' Compare the indecies to prepare handling
759+
#' Compare the indices to prepare handling
760760
#'
761761
#' @details
762762
#' The function compares the object and sampled indices into `new`
@@ -1193,14 +1193,15 @@ srs_diff_est <- function(y_approx, y, y_idx) {
11931193
# eq (9) first row second `+` should be `-`
11941194
# Supplementary material eq (6) has this correct
11951195
# Here the variance is for sum, while in the paper the variance is for mean
1196-
# which explains the proporional difference of 1/n
1196+
# which explains the proportional difference of 1/N
11971197
est_list$hat_v_y <- (t_pi2_tilde + t_hat_epsilon) - # a (has been checked)
11981198
(1/N) * (t_e^2 - est_list$v_y_hat + 2 * t_pi_tilde * est_list$y_hat - t_pi_tilde^2) # b
11991199
est_list
12001200
}
12011201

12021202

1203-
#' Estimate elpd using the standard SRS estimator and SRS WOR
1203+
#' Estimate elpd using the standard simple-re-sample without
1204+
#' resampling (SRS-WOR) estimator
12041205
#' @noRd
12051206
#' @param x A `psis_loo_ss` object.
12061207
#' @return A `psis_loo_ss` object.
@@ -1220,7 +1221,7 @@ loo_subsample_estimation_srs <- function(x) {
12201221
update_psis_loo_ss_estimates(x)
12211222
}
12221223

1223-
#' Simple SRS-WOR estimation
1224+
#' Simple-re-sample without resampling (SRS-WOR) estimation
12241225
#' @noRd
12251226
#' @param y The values observed.
12261227
#' @param y_approx A vector of length N.
@@ -1324,6 +1325,3 @@ assert_subsampling_pointwise <- function(x) {
13241325
checkmate::assert_names(colnames(x), identical.to = c("elpd_loo", "mcse_elpd_loo", "p_loo", "looic", "influence_pareto_k", "idx", "m_i", "elpd_loo_approx"))
13251326
x
13261327
}
1327-
1328-
1329-

man-roxygen/loo-and-compare-references.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
#'
88
#' Vehtari, A., Simpson, D., Gelman, A., Yao, Y., and Gabry, J. (2024).
99
#' Pareto smoothed importance sampling. *Journal of Machine Learning Research*,
10-
#' accepted for publication.
11-
#' [preprint arXiv:1507.02646](https://arxiv.org/abs/1507.02646)
10+
#' 25(72):1-58.
11+
#' [PDF](https://jmlr.org/papers/v25/19-556.html)
1212
#'
1313
#' Sivula, T, Magnusson, M., Matamoros A. A., and Vehtari, A. (2022).
1414
#' Uncertainty in Bayesian leave-one-out cross-validation based model

man-roxygen/loo-and-psis-references.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#' [preprint arXiv:1507.04544](https://arxiv.org/abs/1507.04544)).
77
#'
88
#' Vehtari, A., Simpson, D., Gelman, A., Yao, Y., and Gabry, J. (2024).
9-
#' Pareto smoothed importance sampling. *Journal of Machine Learning Research*,
10-
#' accepted for publication.
11-
#' [preprint arXiv:1507.02646](https://arxiv.org/abs/1507.02646)
9+
#' Pareto smoothed importance sampling. *Journal of Machine Learning Research*,
10+
#' 25(72):1-58.
11+
#' [PDF](https://jmlr.org/papers/v25/19-556.html)
1212
#'

man/compare.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/loo-glossary.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/loo-package.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/loo.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/loo_compare.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/loo_model_weights.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)