Reputation: 9369
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 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 ...)?
Upvotes: 8
Views: 18039
Reputation: 6852
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:
Disclaimer: I'm the author of this package.
Upvotes: 1
Reputation: 91
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.
Upvotes: 0
Reputation: 683
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.
Upvotes: 1
Reputation: 19870
If you have Bioinformatics Toolbox, you can use MAFDR function to calculate p-values adjusted by False Discovery Rate.
Upvotes: 5
Reputation: 124563
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');
Upvotes: 0
Reputation: 398
Have a look at T-test with Bonferroni Correction and related files in the Matlab File-exchange.
I hope this helps.
Upvotes: 0