Adjust p-values for multiple comparisons in Matlab
I have a cell array of p-values that have to be adjusted for multiple comparisons. How can I do that in Matlab? I can't find 开发者_Python百科a built-in function.
In R I would do:
data.pValue_adjusted = p.adjust(data.pValue, method='bonferroni')
Is there a similiar function for Matlab? Ideally one that performs different adjustment methods (Bonferroni, Benjamini-Hochberg, FDR ...)?
If you have Bioinformatics Toolbox, you can use MAFDR function to calculate p-values adjusted by False Discovery Rate.
For people without the Bioinformatics Toolbox, the FDR (False Discovery Rate) method is also very nicely described here, it also provides a link with an fdr script.
A MATLAB/Octave implementation of R's p.adjust
function is available here. It can perform p-value adjustment for multiple comparisons with the following methods, equivalent to their R counterparts:
- Holm
- Hochberg
- Hommel
- Bonferroni
- BH
- BY
- fdr
- Sidak (this one is not available in the R function)
Disclaimer: I'm the author of this package.
This submission is probably what you are looking for, but it only implements the Bonferroni-Holm method. You would have to search the FEX for similar solutions to the other correction methods..
That said the Statistics Toolbox has the MULTCOMPARE method which is designed for multiple comparison tests, though it does not return the corrected p-values. Here is an example:
load fisheriris
[pVal tbl stats] = kruskalwallis(meas(:,1), species) %# Kruskal-Wallis or ANOVA
title('Sepal Length'), xlabel('Groups'), ylabel('Value')
[c,m] = multcompare(stats, 'ctype','bonferroni', 'display','on');
Have a look at T-test with Bonferroni Correction and related files in the Matlab File-exchange.
I hope this helps.
See also http://uk.mathworks.com/matlabcentral/fileexchange/28303-bonferroni-holm-correction-for-multiple-comparisons and https://en.wikipedia.org/wiki/Holm%E2%80%93Bonferroni_method for background.
精彩评论