rvsims {rv} | R Documentation |
rvsims
takes a vector, matrix, or 3-way array (sims
)
containing simulations,
and returns a random vector (an object of type 'rv')
rvsims(sims, n.sims=setnsims(), permute=FALSE, save.order=FALSE)
sims |
an array of simulations (1, 2, or 3-dimensional) |
n.sims |
number of simulations to save |
permute |
logical, indicate if scramble the simulations |
save.order |
logical, indicate if the original order of simulations should be saved (only if permute is TRUE ) |
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 three-dimensional, it is supposed to be output from
a Markov chain simulation program:
the first dimension corresponds to the simulations,
the second corresponds to the chains (typically 3 or 5),
and the last dimension corresponds to the variables.
If permute
is TRUE
, the simulations are scrambled,
i.e. the rows are permuted randomly.
If permute=TRUE
and save.order=TRUE
,
the original order of the simulations
is saved in an attribute rvsim$order
.
If sims
is three-dimensional, the simulations are always scrambled.
Jouni Kerman kerman@stat.columbia.edu http://www.stat.columbia.edu/~kerman
Kerman, Jouni and Gelman, Andrew. Manipulating and Summarizing Posterior Simulations Using Random Variable Objects. Technical report, Columbia University, New York.
# x and y have the same distributions: x <- sims(rnorm(1000)) y <- rvnorm(1)