mcmc_derive: MCMC Derive

Description Usage Arguments Details Value Methods (by class) Examples

View source: R/mcmc-derive.R

Description

Generates an MCMC object with derived parameters from an MCMC object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
mcmc_derive(object, ...)

## S3 method for class 'nlist'
mcmc_derive(
  object,
  expr,
  values = list(),
  monitor = ".*",
  primary = FALSE,
  silent = getOption("mcmcderive.silent", FALSE),
  ...
)

## S3 method for class 'nlists'
mcmc_derive(
  object,
  expr,
  values = list(),
  monitor = ".*",
  primary = FALSE,
  silent = getOption("mcmcderive.silent", FALSE),
  ...
)

## S3 method for class 'mcmc'
mcmc_derive(
  object,
  expr,
  values = list(),
  monitor = ".*",
  primary = FALSE,
  silent = getOption("mcmcderive.silent", FALSE),
  ...
)

## S3 method for class 'mcmc.list'
mcmc_derive(
  object,
  expr,
  values = list(),
  monitor = ".*",
  primary = FALSE,
  parallel = FALSE,
  silent = getOption("mcmcderive.silent", FALSE),
  ...
)

## S3 method for class 'mcmcr'
mcmc_derive(
  object,
  expr,
  values = list(),
  monitor = ".*",
  primary = FALSE,
  parallel = FALSE,
  silent = getOption("mcmcderive.silent", FALSE),
  ...
)

## S3 method for class 'mcmcrs'
mcmc_derive(
  object,
  expr,
  values = list(),
  monitor = ".*",
  primary = FALSE,
  parallel = FALSE,
  silent = getOption("mcmcderive.silent", FALSE),
  ...
)

Arguments

object

An MCMC object.

...

Unused.

expr

A string of the R code defining the values of the derived parameter(s) with respect to the parameters in object.

values

A named list of additional R objects to evaluate in the R expression.

monitor

A regular expression specifying the derived parameter(s) in expr to monitor.

primary

A flag specifying whether to include the original primary parameters in the new MCMC object.

silent

A flag specifying whether to suppress messages and warnings.

parallel

A flag specifying whether to generate the derived parameters for each chain in parallel.

Details

It's important to note that parameters in the expression that also occur in the original object are not included in the new object unless primary = TRUE in which case they are simply copied from the original object to the new one. This applies even when the primary parameters are redefined in values.

Value

An MCMC object with the derived parameter(s).

Methods (by class)

Examples

1
2
3
4
5
6
7
mcmcr::mcmcr_example

expr <- "
 log(alpha2) <- alpha
 gamma <- sum(alpha) * sigma"

mcmc_derive(mcmcr::mcmcr_example, expr, silent = TRUE)

mcmcderive documentation built on Aug. 6, 2021, 9:06 a.m.