0

I have the following matrix (covariance matrix) that is used to generate multivariate normal random variables using the rmvnorm(1,mean_vec_mis,var_mat_mis,) function.

> var_mat_mis
              X1       X2         X3        X4        X5        X6
      X1  2.312824 -3.922786 -3.983619  1.996086 -3.765442 -3.773265
      X2   -3.922786  8.692658  8.690807 -3.384631  8.323126  8.232301
      X3   -3.983619  8.690807  8.717178 -3.433177  8.331151  8.260634
      X4  1.996086 -3.384631 -3.433177  1.813997 -3.242650 -3.252840
      X5   -3.765442  8.323126  8.331150 -3.242650  8.038950  7.950212
      X6 -3.773265  8.232301  8.260634 -3.252840  7.950212  7.883712

And

> mean_vec_mis
      [,1]
X1   5.801017
X2   -11.871049
X3  -11.938292
X4   5.021738
X5  -11.391331
X6  -11.474155

I got this error

Error in rmvnorm(1, mean_vec_mis, var_mat_mis) : 
  sigma must be a symmetric matrix

But the var_mat_mis matrix is symmetric. Why this is happening? Any help is appreciated

Uddin
  • 754
  • 5
  • 18
  • Please provide: https://stackoverflow.com/help/minimal-reproducible-example Please also show your current code. – deschen Mar 17 '21 at 07:43
  • How was this matrix created? Are you sure this isn't a case of this FAQ: https://stackoverflow.com/a/9508558/1412059 – Roland Mar 17 '21 at 07:46
  • 1
    Also, compare (X3, X5) with (X5, X3). They are not even equal when printed. – Roland Mar 17 '21 at 07:48

0 Answers0