sims                   package:rv                   R Documentation

_R_e_t_r_i_e_v_e _t_h_e _S_i_m_u_l_a_t_i_o_n_s _o_f _R_a_n_d_o_m _V_e_c_t_o_r_s

_D_e_s_c_r_i_p_t_i_o_n:

     Returns the simulation matrix for the random variable object 'x'.

_U_s_a_g_e:

      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)

_A_r_g_u_m_e_n_t_s:

       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

_D_e_t_a_i_l_s:

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

_A_u_t_h_o_r(_s):

     Jouni Kerman kerman@stat.columbia.edu <URL:
     http://www.stat.columbia.edu/~kerman>

_R_e_f_e_r_e_n_c_e_s:

     Kerman, Jouni and Gelman, Andrew. Manipulating and Summarizing
     Posterior Simulations Using Random Variable Objects. Technical
     report, Columbia University, New York.

_E_x_a_m_p_l_e_s:

       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

