View source: R/simanalyse-derive.R
sma_derive | R Documentation |
Apply R code to derive new variables.
sma_derive( object = NULL, code, monitor = ".*", values = list(), progress = FALSE, options = furrr::furrr_options() )
object |
An object of class (or that can be coerced to) mcmcrs, mcmcr, nlists or nlist. |
code |
A string of R code to derive posterior samples for new parameters. E.g. "var = sigma^2". |
monitor |
A character vector (or regular expression if a string) specifying the names of the variables in |
values |
A named list of additional R objects to evaluate in the R expression. |
progress |
A flag specifying whether to print a progress bar. |
options |
The future specific options to use with the workers. |
An object of the same class as object
set.seed(10L) code <- "for(i in 1:10){x[i] ~ dnorm(0,1/variance)}" parameters = nlist(variance=4) dat <- sims::sims_simulate(code, parameters = parameters, nsims=2) res <- sma_analyse(dat, code, code.add = "variance ~ dunif(0,10)", mode=sma_set_mode("quick"), monitor="variance") sma_derive(res, "sd=sqrt(variance)") sma_derive(parameters, "sd=sqrt(variance)")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.