draws-RBesT: Transform 'gMAP' to 'draws' objects

draws-RBesTR Documentation

Transform gMAP to draws objects

Description

[Experimental]

Transform a gMAP object to a format supported by the posterior package.

Usage

## S3 method for class 'gMAP'
as_draws(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)

## S3 method for class 'gMAP'
as_draws_matrix(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)

## S3 method for class 'gMAP'
as_draws_array(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)

## S3 method for class 'gMAP'
as_draws_df(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)

## S3 method for class 'gMAP'
as_draws_list(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)

## S3 method for class 'gMAP'
as_draws_rvars(x, variable = NULL, regex = FALSE, inc_warmup = FALSE, ...)

Arguments

x

A gMAP object.

variable

A character vector providing the variables to extract. By default, all variables are extracted.

regex

Logical; Should variable be treated as a (vector of) regular expressions? Any variable in x matching at least one of the regular expressions will be selected. Defaults to FALSE.

inc_warmup

Should warmup draws be included? Defaults to FALSE.

...

Arguments passed to individual methods (if applicable).

Details

To subset iterations, chains, or draws, use the posterior::subset_draws() method after transforming the input object to a draws object.

The function is experimental as the set of exported posterior variables are subject to updates.

See Also

posterior::draws() posterior::subset_draws()

Examples

## Setting up dummy sampling for fast execution of example
## Please use 4 chains and 20x more warmup & iter in practice
.user_mc_options <- options(RBesT.MC.warmup=50, RBesT.MC.iter=100,
                            RBesT.MC.chains=2, RBesT.MC.thin=1)


set.seed(34563)
map_AS <- gMAP(cbind(r, n - r) ~ 1 | study,
  family = binomial,
  data = AS,
  tau.dist = "HalfNormal", tau.prior = 1,
  beta.prior = 2
)

post_AS <- as_draws(map_AS)

## Recover user set sampling defaults
options(.user_mc_options)


RBesT documentation built on March 13, 2026, 5:06 p.m.