How to calculate FDR This is quite a basic question, however I am having trouble.
I have 10 samples. I have calculated the p value for 500 discrete elements within each of the 10 samples. The 500 elements are common to all 10 samples. I now must calculate an FDR.
If I was doing a Bonferroni Correction I would perform the correction per element. However I'm not sure when it comes to the FDR. Is it better to rank all pvalues (10 x 500) and calculate the FDR overall within the sample, or should I calculate an FDR for each element and apply it?
Any help would be appreciated and I apologise for naivity or ignorant language in this question.
 A: What to you mean, elements and samples? Do you mean you have 10 subsamples, each covering the same 500 variables?
It this is the case, I think your P value correction strategy depends on your research question. Very probably, you will want to use information across all samples, either by pooling them or by using mixed-effects models. In that case, you have only 500 tests which you should correct. 
However, if you want to look into the significance pattern within each subsample, then you have two options. If you want the false discovery rate in the whole study to be below 0.05, then you should correct all (10x500) tests jointly. 
However, if it is enough for you that the FDR within each subsample is below 0.05, then you can apply a separate correction within each subsample. In that case, if you take 0.05 as the significance threshold, it is very probable that you have one or two false positives in your results. (The number of false positives in that kind of design is very closely $\sim Binomial(10,0.05)$.) I wouldn't lose my sleep over that, but some people do.  
