PMBio / limix-backup

http://pmbio.github.io/limix/
Apache License 2.0
45 stars 12 forks source link

Covariance Matrix Check #10

Closed letaylor closed 8 years ago

letaylor commented 9 years ago

It might be helpful for users if LIMIX raised a warning when/if the user provides a "covariance matrix" that is not semi-definite positive.

Currently if this happens in test_lmm, the user just gets an array of NAs.

import scipy as sp
import scipy.linalg as la
import warnings

## read in / generate covariance_matrix

eigenvals, eigenvecs = la.eigh(covariance_matrix)
min_eigenval = eigenvals.min()
if min_eigenval < 0: warnings.warn('The covariance is not semi-definite positive (min eigenv=%.2e<0)'%min_eigenval)
clippert commented 9 years ago

Thanks Leland,

You are right. We are going to add something.

Cheers, Christoph

On Tue, Feb 10, 2015 at 8:49 AM, Leland Taylor notifications@github.com wrote:

It might be helpful for users if LIMIX raised a warning when/if the user provides a "covariance matrix" that is not semi-definite positive.

Currently if this happens in test_lmm, the user just gets an array of NAs.

import scipy as sp import scipy.linalg as la import warnings

read in / generate covariance_matrix

eigenvals, eigenvecs = la.eigh(covariance_matrix) min_eigenval = eigenvals.min() if min_eigenval < 0: warnings.warn('The covariance is not semi-definite positive (min eigenv=%.2e<0)'%min_eigenval)

— Reply to this email directly or view it on GitHub https://github.com/PMBio/limix/issues/10.

letaylor commented 9 years ago

Thanks Christoph!

horta commented 8 years ago

I suppose this has been solved.