diff --git a/.gitattributes b/.gitattributes index fce2bdcc..5046e422 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,6 @@ * text=auto data/* binary -src/* text=lf -R/* text=lf +src/* text eol=lf +R/* text eol=lf +*.rda binary + diff --git a/R/diagnostics.R b/R/diagnostics.R index 77b4eb43..3d12bdb4 100644 --- a/R/diagnostics.R +++ b/R/diagnostics.R @@ -11,7 +11,7 @@ #' @name pareto-k-diagnostic #' @param x An object created by [loo()] or [psis()]. #' @param threshold For `pareto_k_ids()`, `threshold` is the minimum \eqn{k} -#' value to flag (default is a sample size `S` dependend threshold +#' value to flag (default is a sample size `S` dependent threshold #' `1 - 1 / log10(S)`). For `mcse_loo()`, if any \eqn{k} estimates are #' greater than `threshold` the MCSE estimate is returned as `NA` #' See **Details** for the motivation behind these defaults. @@ -430,7 +430,7 @@ min_n_eff_by_k <- function(n_eff, kcut) { #' with bigger sample size S we can achieve estimates with small #' probability of large error, it is difficult to get accurate MCSE #' estimates as the bias starts to dominate when k > 0.7 (see Section 3.2.3). -#' Thus the sample size dependend k-ht threshold is capped at 0.7. +#' Thus the sample size dependent k-hat threshold is capped at 0.7. #' @param S sample size #' @param ... unused #' @return threshold diff --git a/R/importance_sampling.R b/R/importance_sampling.R index 80ec5c8a..f8dfd4d3 100644 --- a/R/importance_sampling.R +++ b/R/importance_sampling.R @@ -114,7 +114,7 @@ assert_importance_sampling_method_is_implemented <- function(x){ stop("Importance sampling method '", x, "' is not implemented. Implemented methods: '", - paste0(implemented_is_methods, collapse = "', '"), + paste0(implemented_is_methods(), collapse = "', '"), "'") } } diff --git a/R/loo-glossary.R b/R/loo-glossary.R index 06ba5ce6..804bd58c 100644 --- a/R/loo-glossary.R +++ b/R/loo-glossary.R @@ -7,7 +7,7 @@ #' @template bayesvis-reference #' #' @description -#' The pages provides definitions to key terms. Also see the +#' This page provides definitions of key terms. Also see the #' [FAQ page](https://mc-stan.org/loo/articles/online-only/faq.html) on #' the __loo__ website for answers to frequently asked questions. #' diff --git a/R/loo-package.R b/R/loo-package.R index 12a39200..70e58047 100644 --- a/R/loo-package.R +++ b/R/loo-package.R @@ -82,7 +82,7 @@ #' . #' #' Watanabe, S. (2010). Asymptotic equivalence of Bayes cross validation and -#' widely application information criterion in singular learning theory. +#' widely applicable information criterion in singular learning theory. #' *Journal of Machine Learning Research* **11**, 3571-3594. #' #' Zhang, J., and Stephens, M. A. (2009). A new and efficient estimation method diff --git a/R/loo_compare.psis_loo_ss_list.R b/R/loo_compare.psis_loo_ss_list.R index acd0690b..626f7428 100644 --- a/R/loo_compare.psis_loo_ss_list.R +++ b/R/loo_compare.psis_loo_ss_list.R @@ -31,7 +31,7 @@ loo_compare.psis_loo_ss_list <- function(x, ...) { return(comp) } -#' Compare a reference loo object with a comaprison loo object +#' Compare a reference loo object with a comparison loo object #' @noRd #' @param ref_loo A named list with a `psis_loo_ss` object. #' @param compare_loo A named list with a `psis_loo_ss` object. diff --git a/R/loo_model_weights.R b/R/loo_model_weights.R index 449e8feb..946dc7c3 100644 --- a/R/loo_model_weights.R +++ b/R/loo_model_weights.R @@ -7,7 +7,7 @@ #' #' @export #' @param x A list of `"psis_loo"` objects (objects returned by [loo()]) or -#' pointwise log-likelihood matrices or , one for each model. If the list +#' pointwise log-likelihood matrices, one for each model. If the list #' elements are named the names will be used to label the models in the #' results. Each matrix/object should have dimensions \eqn{S} by \eqn{N}, #' where \eqn{S} is the size of the posterior sample (with all chains merged) diff --git a/R/loo_subsample.R b/R/loo_subsample.R index a12e8a79..cfff0999 100644 --- a/R/loo_subsample.R +++ b/R/loo_subsample.R @@ -417,7 +417,7 @@ update.psis_loo_ss <- function(object, ..., #' @param rep If sampling with replacement is used, an observation can have #' multiple samples and these are then repeated in the returned object if #' `rep=TRUE` (e.g., a vector `c(1,1,2)` indicates that observation 1 has been -#' subampled two times). If `rep=FALSE` only the unique indices are returned. +#' subsampled two times). If `rep=FALSE` only the unique indices are returned. #' #' @return An integer vector. #' diff --git a/R/split_moment_matching.R b/R/split_moment_matching.R index b7bdb111..8ae5c91f 100644 --- a/R/split_moment_matching.R +++ b/R/split_moment_matching.R @@ -21,7 +21,7 @@ #' returns a matrix of log-posterior density values of the unconstrained #' posterior draws passed via `upars`. #' @param log_lik_i_upars A function that takes arguments `x`, `upars`, and `i` -#' and returns a vector of log-likeliood draws of the `i`th observation based +#' and returns a vector of log-likelihood draws of the `i`th observation based #' on the unconstrained posterior draws passed via `upars`. #' @param r_eff_i MCMC relative effective sample size of the `i`'th log #' likelihood draws. diff --git a/R/waic.R b/R/waic.R index b225ba7e..2dac6456 100644 --- a/R/waic.R +++ b/R/waic.R @@ -34,7 +34,7 @@ #' #' @references #' Watanabe, S. (2010). Asymptotic equivalence of Bayes cross validation and -#' widely application information criterion in singular learning theory. +#' widely applicable information criterion in singular learning theory. #' *Journal of Machine Learning Research* **11**, 3571-3594. #' #' @template loo-and-psis-references diff --git a/man/loo-glossary.Rd b/man/loo-glossary.Rd index 7aa19639..250f2e29 100644 --- a/man/loo-glossary.Rd +++ b/man/loo-glossary.Rd @@ -4,7 +4,7 @@ \alias{loo-glossary} \title{LOO package glossary} \description{ -The pages provides definitions to key terms. Also see the +This page provides definitions of key terms. Also see the \href{https://mc-stan.org/loo/articles/online-only/faq.html}{FAQ page} on the \strong{loo} website for answers to frequently asked questions. diff --git a/man/loo-package.Rd b/man/loo-package.Rd index e126f4a3..3b77ed7c 100644 --- a/man/loo-package.Rd +++ b/man/loo-package.Rd @@ -101,7 +101,7 @@ Stan Development Team (2018). RStan: the R interface to Stan, Version 2.17.3. \url{https://mc-stan.org}. Watanabe, S. (2010). Asymptotic equivalence of Bayes cross validation and -widely application information criterion in singular learning theory. +widely applicable information criterion in singular learning theory. \emph{Journal of Machine Learning Research} \strong{11}, 3571-3594. Zhang, J., and Stephens, M. A. (2009). A new and efficient estimation method diff --git a/man/loo_model_weights.Rd b/man/loo_model_weights.Rd index fbcba94c..e7323912 100644 --- a/man/loo_model_weights.Rd +++ b/man/loo_model_weights.Rd @@ -28,7 +28,7 @@ pseudobma_weights(lpd_point, BB = TRUE, BB_n = 1000, alpha = 1) } \arguments{ \item{x}{A list of \code{"psis_loo"} objects (objects returned by \code{\link[=loo]{loo()}}) or -pointwise log-likelihood matrices or , one for each model. If the list +pointwise log-likelihood matrices, one for each model. If the list elements are named the names will be used to label the models in the results. Each matrix/object should have dimensions \eqn{S} by \eqn{N}, where \eqn{S} is the size of the posterior sample (with all chains merged) diff --git a/man/loo_moment_match_split.Rd b/man/loo_moment_match_split.Rd index db69ad6f..91a6d826 100644 --- a/man/loo_moment_match_split.Rd +++ b/man/loo_moment_match_split.Rd @@ -46,7 +46,7 @@ returns a matrix of log-posterior density values of the unconstrained posterior draws passed via \code{upars}.} \item{log_lik_i_upars}{A function that takes arguments \code{x}, \code{upars}, and \code{i} -and returns a vector of log-likeliood draws of the \code{i}th observation based +and returns a vector of log-likelihood draws of the \code{i}th observation based on the unconstrained posterior draws passed via \code{upars}.} \item{r_eff_i}{MCMC relative effective sample size of the \code{i}'th log diff --git a/man/obs_idx.Rd b/man/obs_idx.Rd index da349e7e..d087f64f 100644 --- a/man/obs_idx.Rd +++ b/man/obs_idx.Rd @@ -12,7 +12,7 @@ obs_idx(x, rep = TRUE) \item{rep}{If sampling with replacement is used, an observation can have multiple samples and these are then repeated in the returned object if \code{rep=TRUE} (e.g., a vector \code{c(1,1,2)} indicates that observation 1 has been -subampled two times). If \code{rep=FALSE} only the unique indices are returned.} +subsampled two times). If \code{rep=FALSE} only the unique indices are returned.} } \value{ An integer vector. diff --git a/man/pareto-k-diagnostic.Rd b/man/pareto-k-diagnostic.Rd index bb659f79..fcb2db6f 100644 --- a/man/pareto-k-diagnostic.Rd +++ b/man/pareto-k-diagnostic.Rd @@ -45,7 +45,7 @@ mcse_loo(x, threshold = NULL) \item{x}{An object created by \code{\link[=loo]{loo()}} or \code{\link[=psis]{psis()}}.} \item{threshold}{For \code{pareto_k_ids()}, \code{threshold} is the minimum \eqn{k} -value to flag (default is a sample size \code{S} dependend threshold +value to flag (default is a sample size \code{S} dependent threshold \code{1 - 1 / log10(S)}). For \code{mcse_loo()}, if any \eqn{k} estimates are greater than \code{threshold} the MCSE estimate is returned as \code{NA} See \strong{Details} for the motivation behind these defaults.} diff --git a/man/waic.Rd b/man/waic.Rd index 73db9d8f..345bd638 100644 --- a/man/waic.Rd +++ b/man/waic.Rd @@ -116,7 +116,7 @@ print(compare(waic1, waic2), digits = 2) } \references{ Watanabe, S. (2010). Asymptotic equivalence of Bayes cross validation and -widely application information criterion in singular learning theory. +widely applicable information criterion in singular learning theory. \emph{Journal of Machine Learning Research} \strong{11}, 3571-3594. Vehtari, A., Gelman, A., and Gabry, J. (2017). Practical Bayesian model