Martin Preusse
Martin Preusse

Reputation: 9369

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

Upvotes: 8

Views: 18039

Answers (6)

faken
faken

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:

  • 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.

Upvotes: 1

Fraukje
Fraukje

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

yuk
yuk

Reputation: 19870

If you have Bioinformatics Toolbox, you can use MAFDR function to calculate p-values adjusted by False Discovery Rate.

Upvotes: 5

Amro
Amro

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

ephsmith
ephsmith

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

Related Questions