Package 'posteriordb'

Title: R functionality for posteriordb
Description: R functionality of easy handling of the posteriordb posteriors.
Authors: Mans Magnusson [cre, aut], Paul-Christian Bürkner [aut], Aki Vehtari [aut]
Maintainer: Mans Magnusson <[email protected]>
License: BSD_3_clause + file LICENSE
Version: 0.3.2
Built: 2024-08-18 05:19:10 UTC
Source: https://github.com/stan-dev/posteriordb-r

Help Index


Get all existing alias names from a posterior database

Description

Get all existing alias names from a posterior database

Usage

alias_names(type, pdb = pdb_default())

Arguments

type

type of alias names. Cureently only posteriors.

pdb

a pdb object.


Coerce a [pdb_posterior] to a Data Frame

Description

Coerce a [pdb_posterior] to a Data Frame

Usage

## S3 method for class 'pdb_posterior'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

## S3 method for class 'pdb_posteriors'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

a [pdb_posterior] object.

row.names

NULL or a character vector giving the row names for the data frame. Missing values are not allowed.

optional

Not used.

...

further arguments to as.data.frame for a list.

Details

The dataframe will consist of one row per keyword.


Reference Posterior draws and summary statistics

Description

Reference Posterior draws and summary statistics

Usage

## S3 method for class 'stanfit'
as.reference_posterior_draws(x, info, pdb = pdb_default(), ...)

reference_posterior_draws(x, ...)

as.reference_posterior_draws(x, ...)

pdb_reference_posterior_draws(x, ...)

as.pdb_reference_posterior_draws(x, ...)

## S3 method for class 'character'
reference_posterior_draws(x, pdb = pdb_default(), ...)

## S3 method for class 'pdb_posterior'
reference_posterior_draws(x, ...)

## S3 method for class 'pdb_reference_posterior_info'
reference_posterior_draws(x, pdb = pdb_default(), ...)

## S3 method for class 'draws_list'
as.reference_posterior_draws(x, info, ...)

assert_reference_posterior_draws(x)

Arguments

x

a [posterior] object or a posterior name.

info

a [pdb_reference_posterior_info] object

pdb

a [pdb] object (if [x] is a posterior name)

...

further arguments supplied to specific methods.

Value

a [pdb_reference_posterior] object.


Assert that all checks of the reference posterior draws are true

Description

Assert that all checks of the reference posterior draws are true

Usage

assert_checked_reference_posterior_draws(x)

## S3 method for class 'pdb_reference_posterior_draws'
assert_checked_reference_posterior_draws(x)

## S3 method for class 'pdb_reference_posterior_info'
assert_checked_reference_posterior_draws(x)

assert_checked_summary_statistics_draws(x)

## S3 method for class 'pdb_reference_posterior_draws'
assert_checked_summary_statistics_draws(x)

## S3 method for class 'pdb_reference_posterior_summary_statistic'
assert_checked_summary_statistics_draws(x)

## S3 method for class 'pdb_reference_posterior_info'
assert_checked_summary_statistics_draws(x)

Arguments

x

a [pdb_reference_posterior_draws] object

Details

This functionasserts that the reference posterior draws comply with the criterias of the reference posterior draws.

See https://github.com/stan-dev/posteriordb/blob/master/doc/REFERENCE_POSTERIOR_DEFINITION.md for details.


Get the bibliography of a posterior database

Description

Get the bibliography of a posterior database

Usage

bibliography(pdb, ...)

pdb_bibliography(pdb, ...)

Arguments

pdb

a posterior database connection

...

further arguments passed to [bibtex::read.bib]


Check the content a posterior database

Description

Check the content a posterior database

Usage

check_pdb(
  pdb,
  posterior_names_to_check = NULL,
  run_stan_code_checks = FALSE,
  verbose = TRUE
)

check_pdb_read_model_code(posterior_list)

check_pdb_aliases(pdb)

check_pdb_read_data(posterior_list)

check_pdb_read_reference_posterior_draws(posterior_list)

check_pdb_posterior_run_stan(po)

check_pdb_references(pdb)

check_pdb_posterior_references(posterior_list)

check_pdb_all_models_have_posterior(pdb)

check_pdb_all_data_have_posterior(pdb)

check_pdb_all_reference_posteriors_have_posterior(pdb)

Arguments

pdb

a pdb object

posterior_names_to_check

an vector indicating what posteriors to check in the pdb. Default is NULL (all).

run_stan_code_checks

should checks using Stan be run?

verbose

should check results be printed?

posterior_list

a list of pdb_posterior objects.

po

a pdb_posterior object.

Details

[check_pdb()] checks that the content exists as specified [check_pdb_run_stan()] test to run all posteriors with stan models. [check_pdb_stan_syntax()] check that all stan model code files can be parsed. [check_pdb_aliases()] check that all alias are correct. [check_pdb_read_model_code()] check that posteriors can be read. [check_pdb_posteriors()] check a vector of posterior names. [check_pdb_references()] check that all references in posteriors also exist in bibtex. [check_pdb_all_models_have_posterior()] check that all models belong to a posterior [check_pdb_all_data_have_posterior()] check that all datasets belong to a posterior [check_pdb_all_reference_posteriors_have_posterior()] check that all reference posteriors belong to a posterior

Value

a boolean indicating if the pdb works as it should.


Test a posterior

Description

Test a posterior

Usage

check_pdb_posterior(po, run_stan_code_checks = TRUE, verbose = TRUE)

Arguments

po

a [pdb_posterior] to check.

run_stan_code_checks

should checks using Stan be run?

verbose

should check results be printed?

Details

The function checks that a posterior is consistent.


Check that reference posterior draws follows the reference posterior draws definition.

Description

Check that reference posterior draws follows the reference posterior draws definition.

Usage

check_reference_posterior_draws(x, ...)

## S3 method for class 'character'
check_reference_posterior_draws(x, ...)

## S3 method for class 'pdb_posterior'
check_reference_posterior_draws(x, ...)

## S3 method for class 'pdb_reference_posterior_draws'
check_reference_posterior_draws(x, ...)

Arguments

x

a posterior name, posterior object or reference_posterior_draws object

...

currently not used.


Check that reference posterior draws follows the reference posterior summary definition.

Description

Check that reference posterior draws follows the reference posterior summary definition.

Usage

check_summary_statistics_draws(x, ...)

## S3 method for class 'character'
check_summary_statistics_draws(x, ...)

## S3 method for class 'pdb_posterior'
check_summary_statistics_draws(x, ...)

## S3 method for class 'pdb_reference_posterior_draws'
check_summary_statistics_draws(x, ...)

Arguments

x

a posterior name, posterior object or reference_posterior_draws object

...

currently not used.


Compute a Reference Posteriors for a reference posterior info object

Description

Compute a Reference Posteriors for a reference posterior info object

Usage

compute_reference_posterior_draws(rpi, pdb = pdb_default())

Arguments

rpi

a [reference_posterior_info] object.

pdb

a [pdb] object.


Compute a Reference Posteriors using Rstan

Description

Compute a Reference Posteriors using Rstan

Usage

compute_reference_posterior_draws_stan_sampling(rpi, pdb)

Arguments

rpi

a [reference_posterior_info] object.

pdb

a [pdb] object.


Compute Summary statistics from a reference posterior

Description

Compute Summary statistics from a reference posterior

Usage

compute_reference_posterior_summary_statistic(rpd, summary_statistic = "mean")

compute_summary_statistic(rpd, summary_statistic = "mean")

Arguments

rpd

a [reference_posterior_summary_statistic] object

summary_statistic

summary statistic to compute


Extract data for posterior

Description

Extract data for posterior

Usage

data_file_path(x, ...)

stan_data_file_path(x, ...)

stan_data(x)

Arguments

x

an object to access file path to.

...

further arguments supplied to methods.


Access data and model information

Description

Access data and model information

Usage

data_info(x, ...)

as.data_info(x, ...)

## S3 method for class 'pdb_posterior'
data_info(x, ...)

## S3 method for class 'character'
data_info(x, pdb = pdb_default(), ...)

## S3 method for class 'list'
as.data_info(x, pdb = NULL, ...)

pdb_data_info(x, ...)

as.pdb_data_info(x, ...)

model_info(x, ...)

as.model_info(x, ...)

pdb_model_info(x, ...)

as.pdb_model_info(x, ...)

## S3 method for class 'pdb_posterior'
model_info(x, ...)

## S3 method for class 'character'
model_info(x, pdb = pdb_default(), ...)

## S3 method for class 'list'
as.model_info(x, pdb = NULL, ...)

Arguments

x

a object to access information for.

...

further arguments to methods.

pdb

a pdb object.


Get all existing data names from a posterior database

Description

Get all existing data names from a posterior database

Usage

data_names(pdb = pdb_default(), ...)

## S3 method for class 'pdb_local'
data_names(pdb = pdb_default(), ...)

## S3 method for class 'pdb_github'
data_names(pdb, ...)

## S3 method for class 'pdb_github'
model_names(pdb, ...)

## S3 method for class 'pdb_github'
reference_posterior_names(pdb, ...)

Arguments

pdb

a pdb object.

...

Further argument to methods.


Filter Posteriors in Database

Description

Filter Posteriors in Database

Usage

filter_posteriors(pdb = pdb_default(), ...)

Arguments

pdb

a pdb object.

...

further arguments to supply to dplyr::filter()

Details

Filter posteriors in the database and return list of posteriors/models/data to work with as a list.

The function is built upon the dplyr filter function and follows the exact same syntax. All elements in the 'posteriors/[posterior_name].json', 'models/info/[model_name].json' and 'data/info/[data_name].json' can be used to filter the posterior database. See examples below.


Identify the framework for a given [model_code]

Description

Identify the framework for a given [model_code]

Usage

framework(x)

## S3 method for class 'pdb_model_code'
framework(x)

framework(x) <- value

## S3 replacement method for class 'character'
framework(x) <- value

## S3 replacement method for class 'pdb_model_code'
framework(x) <- value

Arguments

x

a [pdb_model_code] object.

value

a supported framework.


Posterior Data Sets

Description

Posterior Data Sets

Usage

get_data(x, ...)

as.pdb_data(x, ...)

## S3 method for class 'pdb_posterior'
get_data(x, ...)

## S3 method for class 'character'
get_data(x, pdb = pdb_default(), ...)

## S3 method for class 'pdb_data_info'
get_data(x, pdb = pdb_default(), ...)

## S3 method for class 'list'
as.pdb_data(x, info, ...)

pdb_data(x, ...)

Arguments

x

an object to access data from.

...

Currently not used.

pdb

a pdb object.

info

a pdb_data_info object.


Retrieve Github personal access token.

Description

A github personal access token Looks in env var 'GITHUB_PAT'

Usage

github_pat(pdb = NULL)

Arguments

pdb

A posterior datasbase object to extract pat from.


Return the name that the alias points to

Description

Return the name that the alias points to

Usage

handle_aliases(x, type, pdb)

Arguments

x

a name to lookup in alias list

type

type of alias names. Cureently only posteriors.

pdb

a pdb object.


Extract information from a pdb object

Description

Extract information from a pdb object

Usage

info(x)

Arguments

x

a [pdb_data], [pdb_model_code] and [pdb_reference_posterior]

info

a [pdb_]


Set information to a pdb object

Description

Set information to a pdb object

Usage

info(x) <- value

Arguments

x

a [pdb_data], [pdb_model_code] and [pdb_reference_posterior]

value

an info object


Extract and construct model code objects

Description

Extract and construct model code objects

Usage

model_code(x, ...)

as.model_code(x, info, ...)

## S3 method for class 'pdb_posterior'
model_code(x, framework, ...)

## S3 method for class 'character'
model_code(x, framework, pdb = pdb_default(), ...)

## S3 method for class 'pdb_model_info'
model_code(x, framework, pdb = pdb_default(), ...)

## S3 method for class 'stanmodel'
as.model_code(x, info, ...)

## S3 method for class 'character'
as.model_code(x, info, framework, ...)

pdb_model_code(x, ...)

as.pdb_model_code(x, info, ...)

model_code_file_path(x, ...)

## S3 method for class 'pdb_posterior'
model_code_file_path(x, framework, ...)

## S3 method for class 'pdb_model_info'
model_code_file_path(x, framework, pdb = pdb_default(), ...)

## S3 method for class 'character'
model_code_file_path(x, framework, pdb = pdb_default(), ...)

stan_code_file_path(x)

stan_code(x, ...)

as.stan_code(x, info, ...)

pdb_stan_code(x, ...)

Arguments

x

an object to access file path to.

...

further arguments supplied to methods.

info

a pdb_model_info object.

framework

model code framework (e.g. stan).

pdb

a pdb object.

See Also

framework()


Get all existing model names from a posterior database

Description

Get all existing model names from a posterior database

Usage

model_names(pdb = pdb_default(), ...)

## S3 method for class 'pdb_local'
model_names(pdb = pdb_default(), ...)

Arguments

pdb

a pdb object.

...

Further argument to methods.


Extract aliases list from posterior database

Description

Extract aliases list from posterior database

Usage

pdb_aliases(type, pdb)

Arguments

type

type of alias names. Cureently only posteriors.

pdb

a pdb object.


Assert that a file exists

Description

Assert that a file exists

Usage

pdb_assert_file_exist(pdb, path, ...)

## S3 method for class 'pdb_local'
pdb_assert_file_exist(pdb, path, ...)

Arguments

pdb

a pdb object.

path

a pdb path.

...

further arguments supplied to methods.


Returns a writable cache path for a pdb and a path It will create the directory if it does not exist.

Description

Returns a writable cache path for a pdb and a path It will create the directory if it does not exist.

Usage

pdb_cache_path(pdb, path)

Arguments

pdb

a pdb object.

path

a pdb path.


Remove object from cache

Description

Remove object from cache

Usage

pdb_cache_rm(x, ...)

## S3 method for class 'pdb_reference_posterior_draws'
pdb_cache_rm(x, ...)

## S3 method for class 'pdb_data'
pdb_cache_rm(x, ...)

Arguments

x

an object to remove from cache

...

Currently not in use.


Read json file from path

Description

Read json file from path

Usage

pdb_cached_local_file_path(pdb, path, unzip = FALSE)

Arguments

pdb

a pdb to read from.

path

a pdb to read from.

unzip

if true, path is zipped and should be unzipped to cache.

Details

Copies the file to the cache and return path


Compare two stan models for the same data

Description

Compare two stan models for the same data

Usage

pdb_compare_stan_models(po, new_stan_model_code_file, upar_values = NULL)

Arguments

po

a 'pdb_posterior' object

new_stan_model_code_file

a file path to another stan code to compare with

upar_values

a list of values on the constrained space to use for comparisons. Defaults to 100 samples from a standard normal.


Copy a file from a pdb to a local path

Description

Copy a file from a pdb to a local path

Usage

pdb_file_copy(pdb, from, to, overwrite = FALSE, ...)

## S3 method for class 'pdb_local'
pdb_file_copy(pdb, from, to, overwrite = FALSE, ...)

## S3 method for class 'pdb_github'
pdb_file_copy(pdb, from, to, overwrite = FALSE, ...)

Arguments

pdb

a pdb connection.

from

a path in the pdb

to

a local file path

overwrite

overwrite local file.

...

further argument supplied to methods

Value

a boolean indicator as file.copy indicating success.


Create a Posterior Database (pdb) connection

Description

Create a Posterior Database (pdb) connection

Usage

pdb_local(
  path = getOption("pdb_path", Sys.getenv("PDB_PATH")),
  cache_path = tempdir()
)

pdb(x, ...)

## Default S3 method:
pdb(x, ...)

## S3 method for class 'pdb_model_code'
pdb(x, ...)

## S3 method for class 'character'
pdb(x, pdb_type = "local", cache_path = tempdir(), ...)

pdb_default(cache_path = tempdir())

pdb_config(directory = getwd())

pdb_github(
  repo = getOption("pdb_repo", "stan-dev/posteriordb"),
  cache_path = tempdir(),
  ref = "master",
  subdir = NULL,
  auth_token = github_pat(),
  host = "https://api.github.com"
)

Arguments

path

a local path to a posterior database. Defaults to 'pdb_path' option or PDB_PATH environment variable.

cache_path

The path to the pdb cache. Default is R temporary directory. This is used to store files locally and without affecting the database.

x

an object to access a pdb for, if character this is how to identify the pdb (path for local pdb, repo for github pdb)

...

further arguments for specific methods to setup a pdb.

pdb_type

Type of posterior database connection. Either local or github.

directory

the directory to look for the [.pdb_config.yml] file

repo

Repository address in the format 'username/repo[/subdir][@ref|#pull]'. Alternatively, you can specify 'subdir' and/or 'ref' using the respective parameters (see below); if both is specified, the values in 'repo' take precedence.

ref

Desired git reference. Could be a commit, tag, or branch name. Defaults to '"master"'.

subdir

subdirectory within repo that contains the posterior database.

auth_token

To use a private repo, generate a personal access token (PAT) in "https://github.com/settings/tokens" and supply to this argument. This is safer than using a password because you can easily delete a PAT without affecting any others. Defaults to the 'GITHUB_PAT' environment variable.

host

GitHub API host to use. Override with your GitHub enterprise hostname, for example, '"github.hostname.com/api/v3"'.

Details

Connect to a posterior database locally or in a github repo.

[pdb_config()] read [.pdb_config.yml] in [directory] and use that to setup a pdb connection.

The connection [pdb_default()] first checks if there exists a [.pdb_config.yml] file in the working directory. If it exist, [pdb_config()] is used to setup, the connection. If no [.pdb_config.yml] file is found, [pdb_local()] is used to setup a pdb. If no local pdb is found, [pdb_github()] is used.

Value

a pdb object


Extract relevant stan versions

Description

Extract relevant stan versions

Usage

pdb_stan_sampling_versions()

Get version of the pdb

Description

Get version of the pdb

Usage

pdb_version(pdb, ...)

## S3 method for class 'pdb_local'
pdb_version(pdb, ...)

## S3 method for class 'pdb_github'
pdb_version(pdb, ...)

Arguments

pdb

a pdb object to return version for.

...

Further argument to methods.

Value

the git sha for the posterior database.


Set pdb slot

Description

Set pdb slot

Usage

pdb(x) <- value

Arguments

x

a [pdb_data], [pdb_model_code] and [pdb_reference_posterior]

value

a pdb object


Access a posterior in the posterior database

Description

Access a posterior in the posterior database

Usage

posterior(x, pdb = pdb_default(), ...)

as.posterior(x, pdb = pdb_default(), ...)

## S3 method for class 'character'
posterior(x, pdb = pdb_default(), ...)

## S3 method for class 'list'
as.posterior(x, pdb = pdb_default(), ...)

pdb_posterior(x, pdb = pdb_default(), ...)

as.pdb_posterior(x, pdb = pdb_default(), ...)

Arguments

x

a posterior name that exist in the posterior database or a list used to construct a posterior object.

pdb

a pdb posterior database object.

...

currently not in use.

Details

To setup a posterior object from a list, a minimum och a 'pdb_model', 'pdb_data', and a 'dimension' element need to be included. See 'posterior("eight_schools")$dimensions' for an example.


Construct dimension names from a posterior dimension list

Description

Construct dimension names from a posterior dimension list

Usage

posterior_dimension_names(x)

Arguments

x

a dimensions slot from a [pdb_posterior]


Get all existing posterior names from a posterior database or posterior objects.

Description

Get all existing posterior names from a posterior database or posterior objects.

Usage

posterior_names(x = pdb_default(), ...)

posterior_name(x = pdb_default(), ...)

Arguments

x

a pdb, pdb_model_code, pdb_data, posterior object or a list of posterior objects.

...

further arguments supplied to specific methods (not in use)

Details

If a pdb_model_code or a pdb_data object is supplied, the function returns the name of all posteriors that uses the data or the model.


Create Posterior Database tibbles

Description

Create Posterior Database tibbles

Usage

posteriors_tbl_df(pdb = pdb_default(), ...)

Arguments

pdb

a pdb object.

...

further arguments to supply to dplyr::filter()

Details

Generates a tibble data frame of all posteriors in the database and their side information


Read JSON objects from the posterior database

Description

Read JSON objects from the posterior database

Usage

read_json_from_pdb(fn, path, pdb, ...)

Arguments

fn

file name

path

path to file name in pdb

pdb

a [pdb] object

...

further arguments supplied to [jsonlite::read_json()]


Extract data for posterior

Description

Extract data for posterior

Usage

reference_posterior_draws_file_path(x, ...)

## S3 method for class 'pdb_posterior'
reference_posterior_draws_file_path(x, ...)

## S3 method for class 'character'
reference_posterior_draws_file_path(x, pdb = pdb_default(), ...)

## S3 method for class 'pdb_reference_posterior_info'
reference_posterior_draws_file_path(x, pdb = pdb_default(), ...)

Arguments

x

an object to access file path to.

...

further arguments supplied to methods.

pdb

a pdb object.


Reference posterior information

Description

Reference posterior information

Usage

reference_posterior_info(x, type, pdb = pdb_default(), ...)

as.reference_posterior_info(x, type, pdb = pdb_default(), ...)

pdb_reference_posterior_info(x, type, pdb = pdb_default(), ...)

as.pdb_reference_posterior_info(x, type, pdb = pdb_default(), ...)

reference_posterior_draws_info(x, pdb = pdb_default(), ...)

pdb_reference_posterior_draws_info(x, pdb = pdb_default(), ...)

## S3 method for class 'pdb_posterior'
reference_posterior_info(x, type, ...)

## S3 method for class 'character'
reference_posterior_info(x, type, pdb = pdb_default(), ...)

## S3 method for class 'list'
as.reference_posterior_info(x, type = NULL, pdb = NULL, ...)

Arguments

x

a posterior object to access the reference posterior for.

type

Type of reference posterior [draws] or [summary_statistic].

pdb

a pdb posterior database connection.

...

Currently not used.

Details

Reference posterior information on how, when and by whom the reference posterior was computed.

See Also

reference_posterior_draws


Get all existing reference posterior names from a posterior database

Description

Get all existing reference posterior names from a posterior database

Usage

reference_posterior_names(pdb = pdb_default(), type, ...)

## S3 method for class 'pdb_local'
reference_posterior_names(pdb = pdb_default(), type, ...)

Arguments

pdb

a pdb object.

type

supported reference posterior types.

...

Further argument to methods.


Reference posterior summary statistics

Description

Reference posterior summary statistics

Usage

reference_posterior_summary_statistic(x, ...)

pdb_reference_posterior_summary_statistic(x, ...)

## S3 method for class 'character'
reference_posterior_summary_statistic(x, pdb = pdb_default(), type, ...)

## S3 method for class 'pdb_posterior'
reference_posterior_summary_statistic(x, type, ...)

## S3 method for class 'pdb_reference_posterior_info'
reference_posterior_summary_statistic(x, pdb = pdb_default(), type, ...)

## S3 method for class 'list'
reference_posterior_summary_statistic(x, info, type, ...)

reference_posterior_summary_statistics(x, ...)

pdb_reference_posterior_summary_statistics(x, ...)

## S3 method for class 'character'
reference_posterior_summary_statistics(x, pdb = pdb_default(), ...)

## S3 method for class 'pdb_posterior'
reference_posterior_summary_statistics(x, ...)

Arguments

x

a [posterior] object or a posterior name.

...

further arguments supplied to specific methods.

pdb

a [pdb] object (if [x] is a posterior name)

type

the type of summary statistic to extract

info

a [pdb_reference_posterior_info] object

Value

a [pdb_reference_posterior_summary_statistic] object.


Remove objects from local pdb

Description

a function to simplify removing object from a local pdb.

Usage

remove_pdb(x, pdb, ...)

## S3 method for class 'character'
remove_pdb(x, pdb, ...)

## S3 method for class 'pdb_data'
remove_pdb(x, pdb, remove_info = TRUE, ...)

## S3 method for class 'pdb_data_info'
remove_pdb(x, pdb, ...)

## S3 method for class 'pdb_model_code'
remove_pdb(x, pdb, remove_info = TRUE, ...)

## S3 method for class 'pdb_model_info'
remove_pdb(x, pdb, ...)

## S3 method for class 'pdb_posterior'
remove_pdb(x, pdb, ...)

## S3 method for class 'pdb_reference_posterior_draws'
remove_pdb(x, pdb, remove_info = TRUE, ...)

## S3 method for class 'pdb_reference_posterior_info'
remove_pdb(x, pdb, type, ...)

## S3 method for class 'pdb_reference_posterior_summary_statistic'
remove_pdb(x, pdb, remove_info = TRUE, ...)

Arguments

x

an object to remove to the pdb.

pdb

the pdb to remove from. Currently only a local pdb.

...

further arguments supplied to methods.

remove_info

should the information JSON be removed as well?

type

supported reference posterior types.


Rename a pdb object

Description

Rename a pdb object

Usage

rename_pdb(x, new_name, ...)

## S3 method for class 'pdb_data'
rename_pdb(x, new_name, ...)

## S3 method for class 'pdb_posterior'
rename_pdb(x, new_name, ...)

Arguments

x

an object to rename

new_name

the new name of the object

...

further arguments (not in use)


Run Stan on a posterior

Description

Run Stan on a posterior

Usage

run_stan(x, stan_args, ...)

## S3 method for class 'pdb_posterior'
run_stan(x, stan_args, ...)

Arguments

x

a [pdb_posterior] object.

stan_args

Arguments supplied to [rstan::stan] to compute the posterior

...

currently not in use.


Subset a [pdb_reference_posterior_draws] object

Description

Subset a [pdb_reference_posterior_draws] object

Usage

## S3 method for class 'pdb_reference_posterior_draws'
subset(x, variable, ...)

Arguments

x

a [pdb_reference_posterior_draws] to subest

variable

parameter names to subset.

...

Further arguments (not used).


Extract the type of summary statistic

Description

Extract the type of summary statistic

Usage

summary_statistic_type(x)

Arguments

x

a [pdb_reference_posterior_summary_statistic]


Thin draws to reduce their size and autocorrelation of the chains.

Description

Thin [pdb_reference_posterior_draws] objects to reduce their size and autocorrelation of the chains.

Usage

thin_draws.pdb_reference_posterior_draws(x, thin, ...)

Arguments

x

An R object for which the methods are defined.

thin

A positive integer specifying the period for selecting draws.

...

Arguments passed to individual methods (if applicable).

Value

A thinned [pdb_reference_posterior_draws] object.


Write objects to pdb

Description

a function to simplify writing to a local pdb.

Usage

write_pdb(x, pdb, overwrite = FALSE, ...)

## S3 method for class 'pdb_reference_posterior_info'
write_pdb(x, pdb, overwrite = FALSE, type, ...)

## S3 method for class 'pdb_reference_posterior_draws'
write_pdb(x, pdb, overwrite = FALSE, ...)

## S3 method for class 'pdb_reference_posterior_summary_statistic'
write_pdb(x, pdb, overwrite = FALSE, ...)

## S3 method for class 'pdb_data'
write_pdb(x, pdb, overwrite = FALSE, ...)

## S3 method for class 'pdb_data_info'
write_pdb(x, pdb, overwrite = FALSE, ...)

## S3 method for class 'stanmodel'
write_pdb(x, pdb, overwrite = FALSE, ...)

## S3 method for class 'pdb_model_code'
write_pdb(x, pdb, overwrite = FALSE, ...)

## S3 method for class 'pdb_model_info'
write_pdb(x, pdb, overwrite = FALSE, ...)

## S3 method for class 'pdb_posterior'
write_pdb(x, pdb, overwrite = FALSE, ...)

Arguments

x

an object to write to the pdb.

pdb

the pdb to write to. Currently only a local pdb.

overwrite

overwrite existing file?

...

further arguments supplied to methods.

type

supported reference posterior types.