conig / corx

corx: Create and Format Correlation Matrices
Other
4 stars 0 forks source link

adjusted p-values #4

Closed drpedapati closed 3 years ago

drpedapati commented 3 years ago

Excellent package, thank you! The incorporation of partial correlations is seamless.

Could you add functionality for adjusting p-values for multiple comparisons?

As a hack around, I separated the apa_matrix function to reformat the table after manually adjusting p-values (using p.adjust).

Thank you!

conig commented 3 years ago

This is a good idea—I will do this when I can carve out some time. Thanks!

conig commented 3 years ago

@drpedapati I have now included an argument 'adjust_p' on the dev version of the package. The argument gets passed to the psych family of functions. Let me know if you notice any issues. Thanks for the suggestion!

# remotes::install_github("conig/corx@devel")

library(corx)

corx(mtcars[,1:3])$p
#>               mpg          cyl         disp
#> mpg  0.000000e+00 6.112687e-10 9.380327e-10
#> cyl  6.112687e-10 0.000000e+00 1.802838e-12
#> disp 9.380327e-10 1.802838e-12 0.000000e+00

corx(mtcars[,1:3], adjust_p = "bonferroni")$p
#>               mpg          cyl         disp
#> mpg  0.000000e+00 5.501418e-09 8.442294e-09
#> cyl  5.501418e-09 0.000000e+00 1.622554e-11
#> disp 8.442294e-09 1.622554e-11 0.000000e+00