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)
TRUE
)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.
# x and y have the same distributions:
x <- sims(rnorm(1000))
y <- rvnorm(1)
Run the code above in your browser using DataLab