mcmc_derive {mcmcderive} | R Documentation |
MCMC Derive
Description
Generates an MCMC object with derived parameters from an MCMC object.
Usage
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)
-
nlist
: Get derived parameters for annlist::nlist-object()
-
nlists
: Get derived parameters for annlist::nlists-object()
-
mcmc
: Get derived parameters for ancoda::mcmc()
object -
mcmc.list
: Get derived parameters for ancoda::mcmc.list()
object -
mcmcr
: Get derived parameters for anmcmcr::mcmcr-object()
-
mcmcrs
: Get derived parameters for anmcmcr::mcmcrs-object()
Examples
mcmcr::mcmcr_example
expr <- "
log(alpha2) <- alpha
gamma <- sum(alpha) * sigma"
mcmc_derive(mcmcr::mcmcr_example, expr, silent = TRUE)