rvmatrix {rv} | R Documentation |
Arrange a given random vector into a matrix or array form.
rvmatrix(...) rvarray(...)
... |
arguments passed to matrix or to array |
These are 'rv' compatible versions of the functions
rvmatrix
and rvarray
.
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.
n.rows <- 3; n.cols <- 4; n <- (n.rows*n.cols) mu.true <- rnorm(1:n.rows, mean=1:n.rows, sd=1) theta <- rvmatrix(rvnorm(n=n.cols, mean=mu.true, sd=0.5), nrow=n.rows) col.labels <- paste("Time", 1:n.cols, sep=":") row.labels <- paste("Unit", 1:n.rows, sep=":") dimnames(theta) <- list(row.labels, col.labels) print(theta) print(E(theta))