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

How to handle categorical covariates with more than two levels in pg.partial_corr? #419

Open
JohannesWiesner opened this issue Apr 17, 2024 · 1 comment
Assignees
Labels
question 🙋 Further information is requested

Comments

@JohannesWiesner
Copy link

Hi, my data includes subjects from 3 different studies. The study is currently encoded as object type (i.e. study = ['study_1','study_2','study_1',etc]. I would like to check the correlation between two variables of interest while controlling for batch effects (by providing covar=['study']). Is it possible to do this with pg.partial_corr? I've found that I can't provide the variable study as an object type (which would be nice by the way), which probably means I need to include it as a dummy coded variable? Because if I don't do that, a simple mapping of the study name to an integer (0,1,2) would be misleadingly interpreted by pingouin as a continuous covariate?

@raphaelvallat
Copy link
Owner

Hi @JohannesWiesner,

Yes, the correct solution here is indeed to use dummy coding (omitting one of the level). You may find this useful: https://stats.oarc.ucla.edu/spss/faq/coding-systems-for-categorical-variables-in-regression-analysis-2/

Thanks
Raphael

@raphaelvallat raphaelvallat self-assigned this Apr 20, 2024
@raphaelvallat raphaelvallat added the question 🙋 Further information is requested label Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question 🙋 Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants