stephenslab / mashr

An R package for multivariate adaptive shrinkage.
https://stephenslab.github.io/mashr
Other
88 stars 19 forks source link

Is it valid to test whether two posterior means are different with t-test? #131

Open MaximalLife opened 1 month ago

MaximalLife commented 1 month ago

Hello, I'm using mashr for my research, and I'm trying to discriminate eQTLs which are same or different among conditions. I've seen a tutorial from vignette, which uses get_pairwise_sharing_from_samples with an arbitrary cutoff (factor=0.5).

But I'm now trying t-test using posterior mean and standard deviation (sd) values. I'm doing this with following R codes (for example).

When sample size / posterior mean / posterior sd of an eQTL from condition A are 101 / 0.5 / 0.07, and those from condition B are 121 / 0.3 / 0.06,

df <- 100+120
sp <- (100*0.07^2+120*0.06^2)/df
se <- sqrt(sp*(1/101+1/121))
tstat <- (0.5-(0.3))/se
pvalue <- pt(q=tstat, df=df, lower.tail=F)*2

(I'll also do Bonferroni correction) --->> As a result, eQTLs with adjusted p-values below cutoff will be considered A- or B-dominant eQTLs.

So, my question is, Is my idea theoretically valid? Especially I'm a bit confused whether posterior estimates are suitable to become inputs for general t-test.

Could you give me some advice?

pcarbo commented 1 month ago

Hi @MaximalLife to help us understand, can you tell us which mashr vignette you were following?

MaximalLife commented 1 month ago

@pcarbo Thank you for a rapid response!

At first, I followed this: https://stephenslab.github.io/mashr/articles/mash_sampling.html In "Pairwise sharing" chapter, it contains how to compare effects from two conditions, and I understood that mashr uses an arbitrary cutoff for difference of two posterior means to decide condition-specificity of an eQTL.

Instead of the arbitrary cutoff, I'm trying to use t-test to decide whether two posterior means are same or different. I think this way may solve ambiguity during pairwise comparison of eQTLs. But I'm not familiar with statistics, so I'm not sure if my idea is valid.

pcarbo commented 1 month ago

@MaximalLife The statistic you want to compute will depend on what question you are answering. It might help to look at Fig. 5 and the section "Sharing of effects among tissues" in our paper, where we consider two different ways of quantifying sharing of effects across tissues/conditions.