sims: Retrieve the Simulations of Random Vectors

Description Usage Arguments Details Author(s) References Examples

View source: R/sims.R

Description

Returns the simulation matrix for the random variable object x.

Usage

1
2
3
4
5
6
7
sims(x, ...)

## S3 method for class 'rvsummary'
sims(x, dimensions = FALSE, ...)

## S3 method for class 'rv'
sims(x, dimensions = FALSE, n.sims = getnsims(), ...)

Arguments

x

a random variable object

...

arguments passed on

dimensions

logical, try to preserve the dimensions of x

n.sims

(optional) number of simulations

Details

sims returns the matrix of simulations for a given random variable object x.

The first index of the matrix indicates the number of the simulation draw ("simulations are in rows").

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

1
2
3
4
5
  setnsims(n.sims=2500)
  x <- rvnorm(24)
  dim(x) <- c(2,3,4)
  dim(sims(x))                  # 2500x24
  dim(sims(x, dimensions=TRUE)) # 2500x2x3x4

jsta/rv documentation built on Feb. 12, 2022, 5:13 p.m.