Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R2 doc improvements #1712

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/bayes_R2.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
#' If \code{summary = FALSE}, the posterior draws of the Bayesian
#' R-squared values are returned in an S x M matrix (S is the number of draws).
#'
#' @details For an introduction to the approach, see Gelman et al. (2018)
#' @details For an introduction to the approach, see Gelman et al. (2019)
#' and \url{https://github.com/jgabry/bayes_R2/}.
#'
#' @references Andrew Gelman, Ben Goodrich, Jonah Gabry & Aki Vehtari. (2018).
#' R-squared for Bayesian regression models, \emph{The American Statistician}.
#' \code{10.1080/00031305.2018.1549100} (Preprint available at
#' @references Andrew Gelman, Ben Goodrich, Jonah Gabry & Aki Vehtari. (2019).
#' R-squared for Bayesian regression models, \emph{The American Statistician},
#' 73(3):307-309. \code{10.1080/00031305.2018.1549100} (Preprint available at
#' \url{https://stat.columbia.edu/~gelman/research/published/bayes_R2_v3.pdf})
#'
#' @examples
Expand Down
22 changes: 19 additions & 3 deletions R/loo_predict.R
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,25 @@ E_loo_value <- function(x, psis_object, type = "mean", probs = 0.5) {
#'
#' @return If \code{summary = TRUE}, an M x C matrix is returned
#' (M = number of response variables and c = \code{length(probs) + 2})
#' containing summary statistics of the LOO-adjusted R-squared values.
#' If \code{summary = FALSE}, the posterior draws of the LOO-adjusted
#' R-squared values are returned in an S x M matrix (S is the number of draws).
#' containing Bayesian bootstrap based summary statistics of the
#' LOO-adjusted R-squared values. If \code{summary = FALSE}, the
#' Bayesian bootstrap draws of the LOO-adjusted R-squared values
#' are returned in an S x M matrix (S is the number of draws).
#'
#' @details LOO-R2 uses LOO residuals and is defined as
#' \eqn{1-Var_{loo-res} / Var_y},
#' with
#' \deqn{
#' Var_y = V_{n=1}^N y_n, and
#' Var_{loo-res} = V_{n=1}^N \hat{e}_{loo,n},
#' }
#' where \eqn{\hat{e}_{loo,n}=y_n-\hat{y}_{loo,n}}.
#' Bayesian bootstrap is used to draw from the approximated uncertainty
#' distribution as described by Vehtari and Lampinen (2002).
#'
#' @references Vehtari and Lampinen (2002). Bayesian model assessment
#' and comparison using cross-validation predictive densities. Neural
#' Computation, 14(10):2439-2468.
#'
#' @examples
#' \dontrun{
Expand Down
Loading