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

module-traitRelationships negative correlation p values incorrect #73

Closed
richard-k-perez opened this issue Oct 27, 2023 · 3 comments
Closed

Comments

@richard-k-perez
Copy link

Hello,

There is an issue with p value calculation for negative correlations in the module-trait relationship. For example, if I calculate the correlation A vs. B, the results are R=0.7 p <0.01. When I use the same data but now make the trait B vs. A, the results are R =-0.7 p = 0.99. The p-value is always 1-p of the opposite comparison. I tested this myself by extracting the eigenvalues for each of my samples for a module and switched the order of comparison. I reproduced the correlation for both comparisons but only the p value for the correlation. The p value for the negative correlation in my test, was as significant as the positive correlation, which is to be expected.

Hoping you could look into this! May be a very quick fix.

@richard-k-perez richard-k-perez changed the title module-traitRelationships_tmp negative correlation p values incorrect module-traitRelationships negative correlation p values incorrect Oct 27, 2023
@nargesr
Copy link
Member

nargesr commented Oct 27, 2023

Hi,

Thanks for using PyWGCNA, would you mind telling me the approach you used?

On my side, I used scipy.stats.pearsonr with alternative='greater', so I would assume your observation it because you probably go with the alternative='two-sided'.

I'm happy to change the alternative parameter if that's the problem here

@richard-k-perez
Copy link
Author

richard-k-perez commented Oct 27, 2023 via email

@nargesr
Copy link
Member

nargesr commented Oct 27, 2023

Hi @richard-k-perez

sure happy to change it and make it an option in the next release.

Will close this issue once I make a new release.

nargesr added a commit that referenced this issue Nov 7, 2023
@nargesr nargesr closed this as completed Nov 7, 2023
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

2 participants