applyConversions | R Documentation |
Create transformed parameters from original parameters in MCMC output
applyConversions(samples, conversions)
samples |
One of: an |
conversions |
One of: a list of conversion specifications (see
below); a named list of conversion specifications, with names
matching those of a list provided for |
A conversion specification is a named list. For each element:
its name will be the name of a new column appended to a samples
matrix.
its value should be a character string that can be parsed as code
to calculate elements of the new column. It can use existing
column names in samples
. Calculations will be done row-wise.
Column names are often something like "beta[2]". To have this
used as a name, enclose it in backticks, e.g. "`beta[2]`
".
For example, an entry could be log_beta2 = "log(`beta\[2\]`)"
.
A list value of NULL
will remove the named column.
The conversion specification list will be processed in order. This allows creating new columns and removing old ones in a sensible order.
If both conversions
and samples
are named lists, they will be
matched: the conversions
element (itself a list of conversion
specifications) used on a samples
element will have the same
name. If there is no conversions
element for a given samples
element, that samples
element will be included in the returned
list without any conversions.
An object of the same type as samples
after application
of conversions.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.