#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# Bayes Factor for a partial correlation

Hi everyone!

I would like to compute a Bayes Factor for a partial correlation in R. However, the relevant package (BayesMed) seems not to work anymore...

https://rdrr.io/cran/BayesMed/man/jzs_partcorSD.html

Is there any other package or method that I could use?...

Thank you,

Nathalie

• Dear Nathalie,

we are working on an alternative method, but it’s not currently implemented in any software and we need to tidy up some proofs. The new method is relatively straightforward to conduct though (some materials are here https://osf.io/xv2uy/). Basically, we follow the same set up as for the Pearson's correlation (https://onlinelibrary.wiley.com/doi/full/10.1111/stan.12111) which is also used in JASP. The main result is that the Bayes factor for a partial correlation can be computed in the same way as for Pearson's correlation, with substituting n - k (sample size minus the number of controlling variables) instead of n. You can use Correlation analysis in Summary statistics module in JASP to do the Bayes factor calculation, if you already computed the sample partial correlation coefficient and have the n and k. Alternatively you can use the bcor.testSumStat() function from bstats package (https://github.com/AlexanderLyNL/bstats) if you want to use R. The only thing you would need is to subtract the number of controlling variables from the argument "n".

Best,

Simon

• edited November 2021

Hi Simon,

Its a shame the new method has not been implemented in JASP yet.

In the summary statistics module in JASP, I have the partial correlation, n, and k. However, there is no field for me to enter k. My sample size is 216 and I controlled for 12 variables. Just to confirm, can I enter 204 under sample size to get the Bayes factor?