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))

