File Exchange

image thumbnail

Permutation Test

version 2019.2.1.0 (27.5 KB) by Laurens R Krol
A permutation test (aka randomization test) for MATLAB, testing for a difference in means between two samples.

69 Downloads

Updated 01 Feb 2019

GitHub view license on GitHub

A permutation test (aka randomization test) for MATLAB, testing for a difference in means between two samples. It supports one- and two-tailed tests, and returns a p-value, the observed difference, and the effect size. The result can optionally be visualized using a histogram. It is also possible to perform exact tests, during which all possible permutations are considered.

Cite As

Laurens R Krol (2019). Permutation Test (https://www.github.com/lrkrol/permutationTest), GitHub. Retrieved .

Comments and Ratings (6)

Dear Miguel, this sounds like a comma might have accidentally been deleted on your end. Please re-download the exact file provided here and run it again. If you continue to have issues, it would be better if you could open a new issue on GitHub: https://github.com/lrkrol/permutationTest/issues

If I try to run the exact same example that you provided:

sample1 = randn(1,5000);
sample2 = randn(1,5000) + .1;
permutationTest(sample1, sample2, 10000, 'plotresult', 1);

The code gives the "Error: File: permutationTest.m Line: 81 Column: 80
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct
matrices, use brackets instead of parentheses". I am a beginner in MATLAB coding. Is there anyway to workaround this?

Thanks for this code, very easy to use and understand.

Works really well! Thanks for the upload :)

Updates

2019.2.1.0

- Changed number of bins in the plot
- Added separate script permutationPrecision
- Updated documentation

2018.3.14.0

Cosmetic changes

2018.3.14.0

Added exact test

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux