rvsims                  package:rv                  R Documentation

_C_r_e_a_t_e _a _R_a_n_d_o_m _V_e_c_t_o_r _f_r_o_m _a _M_a_t_r_i_x _o_f _S_i_m_u_l_a_t_i_o_n_s

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

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

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

       rvsims(sims, n.sims=rvnsims(), permute=FALSE, save.order=FALSE)

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

    sims: an array of simulations (1, 2, or 3-dimensional)

  n.sims: number of simulations to save

 permute: logical, indicate if scramble the simulations

save.order: logical, indicate if the original order of simulations
          should be saved (only if permute is 'TRUE')

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

     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 three-dimensional, it is supposed to be output from a
     Markov chain simulation program: the first dimension corresponds
     to the simulations,  the second corresponds to the chains
     (typically 3 or 5), and the last dimension corresponds to the
     variables.

     If 'permute' is 'TRUE', the simulations are scrambled, i.e. the
     _rows_ are permuted randomly. If 'permute=TRUE' _and_
     'save.order=TRUE', the original order of the simulations is saved
     in an attribute 'rvsim$order'.

     If 'sims' is three-dimensional, the simulations are always
     scrambled.

_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 and y have the same distributions:
       x <- sims(rnorm(1000))
       y <- rvnorm(1)

