Skip to content

Commit

Permalink
Merge branch 'master' into export-helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
n-kall authored May 15, 2024
2 parents beadac1 + 419a1a3 commit ee9d36f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 13 deletions.
11 changes: 10 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

### Enhancements

* Add `pareto_smooth` option to `weight_draws`, to Pareto smooth
* Add `exclude` option to `subset_draws()`, which can be used to exclude
the matched selection.
* Add `are_log_weights` option to `pareto_smooth()`, which is necessary
for correct Pareto smoothing computation if the input vector
consists of log weights.
* Add `pareto_smooth` option to `weight_draws()`, to Pareto smooth
weights before adding to a draws object.
* Add individual Pareto diagnostic functions (`pareto_khat()`,
`pareto_khat_threshold()`, `pareto_min_ss()`, `pareto_convergence_rate()`)
* `thin_draws()` now automatically thins draws based on ESS by default,
and non-integer thinning is possible.
* Matrix multiplication of `rvar`s can now be done with the base matrix
multiplication operator (`%*%`) instead of `%**%` in R >= 4.3.
* `variables()`, `variables<-()`, `set_variables()`, and `nvariables()` now
Expand Down
2 changes: 1 addition & 1 deletion R/pareto_smooth.R
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ pareto_smooth.rvar <- function(x, return_k = FALSE, extra_diags = FALSE, ...) {
#' @export
pareto_smooth.default <- function(x,
tail = c("both", "right", "left"),
r_eff = 1,
r_eff = NULL,
ndraws_tail = NULL,
return_k = FALSE,
extra_diags = FALSE,
Expand Down
7 changes: 7 additions & 0 deletions R/rvar-.R
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,13 @@ drop_chain_dim <- function(x) {
#' (first one is draws), etc.
#' @noRd
cleanup_rvar_draws <- function(x) {
assert(
check_numeric(x),
check_logical(x),
check_factor(x),
check_character(x)
)

if (length(x) == 0) {
# canonical NULL rvar is at least 1 draw of nothing
# this ensures that (e.g.) extending a null rvar
Expand Down
2 changes: 1 addition & 1 deletion man-roxygen/args-pareto.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' al. (2024)).
#' @param r_eff (numeric) relative effective sample size estimate. If
#' `r_eff` is NULL, it will be calculated assuming the draws are
#' from MCMC. Default is 1.
#' from MCMC. Default is NULL.
#' @param verbose (logical) Should diagnostic messages be printed? If
#' `TRUE`, messages related to Pareto diagnostics will be
#' printed. Default is `FALSE`.
Expand Down
6 changes: 3 additions & 3 deletions man/pareto_diags.Rd

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

6 changes: 3 additions & 3 deletions man/pareto_khat.Rd

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

8 changes: 4 additions & 4 deletions man/pareto_smooth.Rd

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

0 comments on commit ee9d36f

Please sign in to comment.