I noticed this odd result when using matlab's FDR function - thought maybe someone might want to comment. Maybe I am using the function badly - but I guess I might not be the only one if so - thanks.
fp = [0,0];
N_sims = 1000;
N_samp = 20;
adj_p2 = nan(N_samp,1);adj_p1 = nan(N_samp,1);
for ix = 1:N_sims
p = rand(N_samp,1);
[adj_p1,Q] = mafdr(p);
fp = fp + double([adj_p1,adj_p2]<0.05);
result: 3.3 (and near 0.05 as expected with version from https://www.mathworks.com/matlabcentral/fileexchange/27418-fdr-bh)
I found this which was relevant (although it's for 2012, while I am using 2018a): https://www.mathworks.com/matlabcentral/answers/44824-why-am-i-getting-a-warning-in-mafdr-when-using-my-list-of-p-values
There is a suggestion there to set lambda = 0.15. This does seem to work, infact, pretty much any value of lambda that is settable seems to give more reasonable answers than when it is not set.
It seems a bit dangerous that by default mafdr has this odd behavior if lambda is not set.