theislab / scCODA

A Bayesian model for compositional single-cell data analysis
BSD 3-Clause "New" or "Revised" License
141 stars 23 forks source link

scCODA p-values? #72

Closed katieaney closed 4 months ago

katieaney commented 1 year ago

Hi,

This is question, not an issue.

I am running scCODA compositional analysis followed by HMC sampling. I can see the result summary and extended summary as detailed in the documentation. I can then use Arviz to plot traces and kernel density estimates. My question is - how might I estimate the p-values for the fold changes that are calculated using scCODA? I tried calculating the p-val using the HPD interval, but I'm unable to find a package that can do this (tried Arviz and PyMC3). Is scCODA able to do this?

Any suggestions or direction would be appreciated.

The code I'm using, if that is helpful: model_R = mod.CompositionalAnalysis(R, formula="Condition", reference_cell_type="automatic") sim_results = model_R.sample_hmc() sim_results.summary_extended(hdi_prob=0.9)

johannesostner commented 1 year ago

Hi @katieaney, scCODA performs parameter inference via Bayesian methods (HMC sampling). These methods, opposed to frequentist hypothesis testing, do not produce p-values. You can compare the confidence of effects via other measures, e.g. the inclusion probability (see #47 ), which is also used to get the credible effects at different FDR values.

The fold-changes in the summary are simply calculated by looking at the difference of expected compositions with/without the respective condition active, using the inferred parameters