sims {rv} | R Documentation |
Returns the simulation matrix for the random variable object x
.
sims(x, n.sims=NULL, dimensions=FALSE, sim.matrix=FALSE, mc.array=FALSE) ## Default S3 method: sims(x, ...) ## S3 method for class 'rv': sims(x, n.sims=NULL, dimensions=FALSE, sim.matrix=FALSE, mc.array=FALSE)
x |
a random variable object |
n.sims |
(optional) number of simulations |
dimensions |
logical, try to preserve the dimensions of x |
sim.matrix |
logical, (if dimensions is TRUE) indicate if want to return the plain simulation matrix as attribute ``sim.matrix" |
mc.array |
logical, indicate if want to return the original 3-way mcmc matrix, if possible |
... |
omitted arguments |
sims
returns the matrix of simulations for a given random variable object x
.
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 <- rvnorm(24) # Suppose that L is the number of simulations per scalar dim(x) <- c(2,3,4) dim(sims(x)) # Lx24 dim(sims(x, dimensions=TRUE)) # Lx2x3x4 dim(attr(sims(x, dimensions=TRUE, sim.matrix=TRUE), "sim.matrix")) # Lx24 ## Not run: dim(sims(x, mc.array=TRUE)) # Error: x was not generated by a mcmc process