0todd0000 / spm1d

One-Dimensional Statistical Parametric Mapping in Python
GNU General Public License v3.0
60 stars 21 forks source link

Post hoc after non parametric 1d_anova1rm in Matlab #286

Open gingerkongen opened 2 months ago

gingerkongen commented 2 months ago
Hi, Todd

I want to conduct a post hoc following the non parametric 1d_anova1rm. however I struggle to find a good way to do this. Can you help?

The code I used for the anova is below. Y= knee flexion during three different conditions. Therefore the post hoc must compare the three conditions pairwise.

"" clear; clc

% Last inn data fra Excel-filene Y = importdata('Matlab1.xlsx'); A = importdata('Matlab2.xlsx'); SUBJ = importdata('Matlab3.xlsx');

% Forbered en tom matrise for dobbeltverdier Y_double = zeros(size(Y));

% Konverter strengene til dobbeltverdier for i = 1:numel(Y) Y_double(i) = str2double(Y{i});

end

%(1) Conduct non-parametric test: rng(0) alpha = 0.05; iterations = 100; snpm = spm1d.stats.nonparam.anova1rm(Y_double, A, SUBJ); snpmi = snpm.inference(alpha, 'iterations', iterations); disp('Non-Parametric results') disp( snpmi )

%(2) Compare to parametric inference: spm = spm1d.stats.anova1rm(Y_double, A, SUBJ); spmi = spm.inference(alpha); disp('Parametric results') disp( spmi ) % plot: close all

% Plot med x-aksen fra 0 til 100 figure; spmi.plot(); hold on

% Begrens x-aksen til 0, 50 og 100 xticks([0, 25, 50, 75, 100]); yticks([0, 60, 120, 180]);

title('SPM ANOVA', 'FontSize', 18); xlabel('Time (%)');

% Plot med x-aksen fra 0 til 100 figure; snpmi.plot(); hold on

% Begrens x-aksen til 0, 50 og 100 xticks([0, 25, 50, 75, 100]); yticks([0, 60, 120, 180]);

title('SPM ANOVA', 'FontSize', 18); xlabel('Time (%)'); ""

Thank you

0todd0000 commented 1 month ago

Apologies for the delay! I missed your question in my inbox. For anova1rm paired t tests are an appropriate post hoc procedure, so I suggest conducting paired post hoc tests using spm1d.stats.ttest_paired, and adjusting the critical p-value for the number of pairs.