How to correctly set up a particular Paired ANOVA test?

16 views (last 30 days)
I am trying to set up a paired ANOVA test to observe comparisons of data to a baseline for multiple locations.
My data is set up such that I have 1 measurement at each location for 5 time periods (a baseline and 4 future times). I want to compare the baseline to each time period (ie baseline vs period 1, baseline vs period 2, etc), while keeping each location as a single observation over multiple time frames. I am trying to set up the rm to properly fit ranova (or should I be using multcompare?), however the tables that I create keep feeding me errors, or only give me 1 p-value, which doesn't allow me to compare the baseline to each individual time frame. I think my issue is in how I am setting up the table, but I am having a hard time understanding how the inputs should be formatted.

Answers (1)

Ive J
Ive J on 21 Dec 2020
Edited: Ive J on 21 Dec 2020
You can use ranova, but as you've realized it does not do multiple comparisons for you. You can do the post-hoc test with pairwise paired t-tests and adjust it for FWER (simplest would be Bonferroni) or FDR. Please note that it's just an example: meaning you shoud take care of you data structure (skewness, etc) to see if you need any data transformation or nonparametric tests.
% creat a table
t = table(rand(10, 4), 'VariableNames', {'time'});
t = splitvars(t)
10×4 table
time_1 time_2 time_3 time_4
_______ ________ _______ ________
0.35166 0.075854 0.16218 0.45054
0.83083 0.05395 0.79428 0.083821
0.58526 0.5308 0.31122 0.22898
0.54972 0.77917 0.52853 0.91334
0.91719 0.93401 0.16565 0.15238
0.28584 0.12991 0.60198 0.82582
0.7572 0.56882 0.26297 0.53834
0.75373 0.46939 0.65408 0.99613
0.38045 0.011902 0.68921 0.078176
0.56782 0.33712 0.74815 0.44268
pvals = (0);
for i = 1:size(t, 2)-1
[~, pvals(i)] = ttest(t.time_1, t.(i+1)); % compare time_1 to other time points in a pairwise manner
end
bonf = 0.05/numel(pvals) % adjust for Bonferroni
pvals <= bonf
1×3 logical array
0 0 0
% non of them passed Bonferroni cutoff

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!