Skip to content

Commit

Permalink
fix R cmd check doc warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jgabry committed Nov 15, 2022
1 parent d180cbf commit 9b9a8a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 9 additions & 8 deletions R/loo_subsample.R
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ loo_subsample.function <-
#'
#' @export
#' @inheritParams loo_subsample.function
#' @param data,draws See [loo_subsample.function()].
#' @param object A `psis_loo_ss` object to update.
#' @param ... Currently not used.
#' @return A `psis_loo_ss` object.
Expand Down Expand Up @@ -469,10 +470,10 @@ estimator_choices <- function() {
## Approximate elpd -----

#' Utility function to apply user-specified log-likelihood to a single data point
#' @details
#' @details
#' See [elpd_loo_approximation] and [compute_lpds] for usage examples
#' @noRd
#'
#'
#' @return lpd value for a single data point i
lpd_i <- function(i, llfun, data, draws) {
ll_i <- llfun(data_i = data[i,, drop=FALSE], draws = draws)
Expand All @@ -482,12 +483,12 @@ lpd_i <- function(i, llfun, data, draws) {
}


#' Utility function to compute lpd using user-defined likelihood function
#' Utility function to compute lpd using user-defined likelihood function
#' using platform-dependent parallel backends when cores > 1
#'
#' @details
#'
#' @details
#' See [elpd_loo_approximation] for usage examples
#'
#'
#' @noRd
#' @return a vector of computed log probability densities
compute_lpds <- function(N, data, draws, llfun, cores) {
Expand All @@ -502,7 +503,7 @@ compute_lpds <- function(N, data, draws, llfun, cores) {
lpds <- parLapply(cl, X = seq_len(N), fun = lpd_i, llfun, data, draws)
}
}

unlist(lpds)
}

Expand Down Expand Up @@ -570,7 +571,7 @@ elpd_loo_approximation <- function(.llfun, data, draws, cores, loo_approximation
point_est <- .compute_point_estimate(draws)
# Compute the lpds
lpds <- compute_lpds(N, data, point_est, .llfun, cores)

if (loo_approximation == "waic_grad" |
loo_approximation == "waic_hess") {
cov_est <- stats::cov(draws)
Expand Down
2 changes: 2 additions & 0 deletions man/update.psis_loo_ss.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9b9a8a8

Please sign in to comment.