This script gets an axis handle and a 4D matrix (stats) and plots significance lines and asterisks on top.
Significance lines and asterisks are added only for pairs assigned with a positive value (the number of asterisks) in stats. For non-integer values, the p-value is displayed instead.
To set the stats matrix, simply initialize a 4D matrix with the first two dimensions corresponding to categories, and the last two dimensions to groups (see the examples file).
Then, assign the number of asterisks (or p-value) to the relevant pairs. For example:
stats = zeros(5,5,4,4); % Initialize the stats matrix for 5 categories and 4 groups.
stats(1,3,1,2) = 2; % Add a significance line and two asterisks between the bar of category 1, group 1, and the bar of category 3, group 2.
This script takes into account error bars when adding significance lines, and can also deal with bar plots generated using the 'hist' parameter (see example 2).
引用格式
Omer Yuval (2024). Statistical Significance (https://www.mathworks.com/matlabcentral/fileexchange/92613-statistical-significance), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2020b
兼容任何版本
平台兼容性
Windows macOS Linux标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0 |