rvsims {rv} | R Documentation |
rvsims
takes a vector, matrix, or list (sims
)
containing simulations,
and returns a random vector (an object of type 'rv')
rvsims(sims, n.sims=getnsims(), permute=FALSE)
sims |
an array of simulations (1, or 2-dimensional) or a list |
n.sims |
number of simulations to save |
permute |
logical, indicate if scramble the simulations |
A vector is interpreted to contain simulations for one single random variable.
If sims
is two-dimensional, the columns are supposed to
contain simulations for several random variables.
If sims
is a list, the numeric vectors are recursively combined to
a list of random vectors: each component of the list is supposed to be
containing one (joint) draw from some distribution—this may be a list.
If permute
is TRUE
, the simulations are scrambled,
i.e. the joint draws are permuted randomly.
Jouni Kerman jouni@kerman.com
Kerman, J. and Gelman, A. (2007). Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Statistics and Computing 17:3, 235-244.
See also vignette("rv")
.
# x and y have the same distributions: setnsims(200) y <- rvnorm(1) x <- sims(rnorm(200)) #