**20**wrote:

Hi all, I'm wondering if someone could put me on the right path to using the "qvalue" package correctly. I have an actual P value of 0.05. I have a list of 1,000 randomised p values: range of these randomised p values is 0.002 to 0.795, average of the randomised p values is 0.399 and the median of the randomised p values is 0.45. 869 of the randomised p values are > 0.05.

I want to work out the false discovery rate (FDR) (Q; as described by Storey and Tibshriani in 2003) for my original p value, defined as the number of expected false positives over the number of significant results for my original P value.

So, for my original P value, I want one Q value, that has been calculated as described above based on the 1,000 random p values.

I wrote this code:

pvals <- c(list_of_p_values_obtained_from_randomisations) qobj <-qvalue(p=pvals) r_output <- qobj$pi0

In this case, r_output (i.e. the Q value) is 0.0062. So I thought it would be reasonable to expect the FDR Q Value (i.e the number of expected false positives over the number of significant results) to be at least over 0.05, given that 869 of the randomised p values are > 0.05? . That's why I think qobj$pi0 isn't the right variable to be looking at? So my problem (or my mis-understanding) is that I have an actual P value of 0.05, but then a Q value that is lower, 0.006?

Could someone please tell me where I'm going wrong.

Thanks

Tom

**60**• written 19 months ago by tombernardryan •

**20**