Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Covariance matrix is not non-negative definite #56

Open
frederikvand opened this issue Nov 8, 2019 · 1 comment
Open

Covariance matrix is not non-negative definite #56

frederikvand opened this issue Nov 8, 2019 · 1 comment

Comments

@frederikvand
Copy link

Error in princomp.default(covmat = covMat[[1]], cor = spca) :
covariance matrix is not non-negative definite

Error on PCA's of worldclim data. Tested on 6 different worldclim datasets and tested on 5 different machines (3 windows, 1 mac and 1 linux supercluster).

PCA_he45bi70 <- rasterPCA(he45bi70,spca=TRUE, nComp = 3, maskCheck = F)
Tested with maskcheck F and T.

@frederikvand
Copy link
Author

frederikvand commented Nov 9, 2019

1 solution would be to include the method of Rebonato and Jackel (2000), as elaborated by Brissette et al. (2007), to fix the eigenvalue matrix. The method advises to replace the negative eigenvalues with 0 (or a small positive number as Brissette et al. 2007 suggest), then normalize the new vector.

Another solution that worked is to work with nsamples.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant