matlabstatisticsp-valuebonferroni

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 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 ...)?


Solution

  • 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');