0

The Error: LinAlgError: Singular matrix

I am using the function correlate() from python package 'mcerp'. My error comes when trying to input this correlation matrix into the function.

array([[1.  , 0.  , 0.1 , 0.1 , 0.1 , 0.1 , 0.1 , 0.3 , 0.5 , 0.  , 0.3 ,
    0.6 , 0.  , 0.  , 0.  ],
   [0.  , 1.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  ,
    0.  , 0.  , 0.  , 0.  ],
   [0.1 , 0.  , 1.  , 0.2 , 0.4 , 0.2 , 0.2 , 0.05, 0.2 , 0.  , 0.1 ,
    0.1 , 0.  , 0.  , 0.  ],
   [0.1 , 0.  , 0.2 , 1.  , 0.2 , 0.1 , 0.05, 0.1 , 0.3 , 0.  , 0.3 ,
    0.4 , 0.  , 0.  , 0.  ],
   [0.1 , 0.  , 0.4 , 0.2 , 1.  , 0.1 , 0.1 , 0.1 , 0.1 , 0.  , 0.1 ,
    0.1 , 0.  , 0.  , 0.  ],
   [0.1 , 0.  , 0.2 , 0.1 , 0.1 , 1.  , 0.1 , 0.1 , 0.1 , 0.  , 0.1 ,
    0.1 , 0.  , 0.  , 0.  ],
   [0.1 , 0.  , 0.2 , 0.05, 0.1 , 0.1 , 1.  , 0.1 , 0.1 , 0.  , 0.1 ,
    0.1 , 0.  , 0.  , 0.  ],
   [0.3 , 0.  , 0.05, 0.1 , 0.1 , 0.1 , 0.1 , 1.  , 0.2 , 0.  , 0.2 ,
    0.2 , 0.  , 0.  , 0.  ],
   [0.5 , 0.  , 0.2 , 0.3 , 0.1 , 0.1 , 0.1 , 0.2 , 1.  , 0.  , 0.3 ,
    0.4 , 0.  , 0.  , 0.  ],
   [0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 1.  , 0.  ,
    0.  , 0.  , 0.  , 0.  ],
   [0.3 , 0.  , 0.1 , 0.3 , 0.1 , 0.1 , 0.1 , 0.2 , 0.3 , 0.  , 1.  ,
    0.5 , 0.  , 0.  , 0.  ],
   [0.6 , 0.  , 0.1 , 0.4 , 0.1 , 0.1 , 0.1 , 0.2 , 0.4 , 0.  , 0.5 ,
    1.  , 0.  , 0.  , 0.  ],
   [0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  ,
    0.  , 1.  , 0.  , 0.  ],
   [0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  ,
    0.  , 0.  , 1.  , 0.  ],
   [0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  ,
    0.  , 0.  , 0.  , 1.  ]])

I understand from reading online this means the determinant is 0, and collinearity might exist within the matrix. However, this is a correlation matrix.

My determinant is not 0.

np.linalg.det(mtrx)

Out[269]: 0.15753298826875

Can anyone explain why THIS matrix specifically is singular? Or help me resolve this issue?

wgraves25
  • 27
  • 4
  • Can you include your table as text? (In CSV format would make it easiest for me to put into my math programs! That or `{{a,b,c},{d,e,f},{g,h,i}}`). Note images should be used sparingly, many work computers/people block the image host (in addition to other issues). – Rogue Mar 31 '23 at 14:07

0 Answers0