rvsims {rv}R Documentation

Create Random Vectors from Simulation Draws

Description

rvsims takes a vector, matrix, or list (sims) containing simulations, and returns a random vector (an object of type 'rv')

Usage

  rvsims(sims, n.sims=getnsims(), permute=FALSE)

Arguments

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

Details

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.

Author(s)

Jouni Kerman jouni@kerman.com

References

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").

Examples

  # x and y have the same distributions:
  setnsims(200)
  y <- rvnorm(1)
  x <- sims(rnorm(200))
  # 

[Package rv version 1.0 Index]