mvrnorm                 package:MASS                 R Documentation

_S_i_m_u_l_a_t_e _f_r_o_m _a _M_u_l_t_i_v_a_r_i_a_t_e _N_o_r_m_a_l _D_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Produces one or more samples from the specified multivariate
     normal distribution.

_U_s_a_g_e:

     mvrnorm(n = 1, mu, Sigma, tol = 1e-6, empirical = FALSE)

_A_r_g_u_m_e_n_t_s:

       n: the number of samples required. 

      mu: a vector giving the means of the variables. 

   Sigma: a positive-definite symmetric matrix specifying the
          covariance matrix of the variables. 

     tol: tolerance (relative to largest variance) for numerical lack
          of positive-definiteness in 'Sigma'. 

empirical: logical. If true, mu and Sigma specify the empirical not
          population mean and covariance matrix. 

_D_e_t_a_i_l_s:

     The matrix decomposition is done via 'eigen'; although a Choleski
     decomposition might be faster, the eigendecomposition is stabler.

_V_a_l_u_e:

     If 'n = 1' a vector of the same length as 'mu', otherwise an 'n'
     by 'length(mu)' matrix with one sample in each row.

_S_i_d_e _E_f_f_e_c_t_s:

     Causes creation of the dataset '.Random.seed' if it does not
     already exist, otherwise its value is updated.

_R_e_f_e_r_e_n_c_e_s:

     B. D. Ripley (1987) _Stochastic Simulation._ Wiley. Page 98.

_S_e_e _A_l_s_o:

     'rnorm'

_E_x_a_m_p_l_e_s:

     Sigma <- matrix(c(10,3,3,2),2,2)
     Sigma
     var(mvrnorm(n=1000, rep(0, 2), Sigma))
     var(mvrnorm(n=1000, rep(0, 2), Sigma, empirical = TRUE))

