-
Notifications
You must be signed in to change notification settings - Fork 13
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
fitnullmodel error for matrix with negatives #74
Comments
Could you please provide some additional detail on what you are doing? It's possible (though uncommon) that a GRM/KM can have issues that lead to a non-positive definite matrix that needs to be inverted in the REML procedure. The presence of negative values in the GRM/KM is not necessarily problematic though -- in fact, a standard GRM will certainly have negative values. |
To build the GRM I am using the results from pcrelate transformed to matrix using pcrelateToMatrix(), which I guess in part uses the PCs generated by pc-air to build. I am not sure exactly which function might be generating the negative values. So I could just invert the GRM results from pcrelateToMatrix and use that for fitNullModel? |
Yes, pcrelate uses the PCs from pcair to adjust for (or "remove") the correlation due to ancestry (as captured by the PCs). Using the pcrelateToMatrix function to format the results from pcrelate as a matrix is the correct thing to do. The fact that you have negative values in the pcrelate kinship matrix (or a GRM) is not a problem; that is perfectly fine and expected. A positive definite matrix can have negative values. One of the more common issues I've seen that can lead to a non-positive definite matrix is when your sample set includes duplicates or MZ twins. You could check for those -- if you have any, try removing one sample from the pair and running again. |
Trying to do run the fitnullmodel using a grm covariate matrix generated with pc-air. I get:
Error in asMethod(object) : not a positive definite matrix
This seem to stem from having negative values generated with king and pc-air in the matrix. Some issue with how cholesky decomposition is performed I guess, but why does this happen?
The text was updated successfully, but these errors were encountered: