How can I make a graph like this for ANOVA 2-Way
Show older comments
I'm trying to obtain this graph from the example here for my ANOVA data: https://www.mathworks.com/matlabcentral/answers/488962-repeated-measures-anova-matlab?s_tid=srchtitle. However, I am having a hard time understanding the code. This is the code I've written for my data so far.
clear
clc
table1 = readtable('assignment3simple.xlsx');
table1matrix = table1{:,2:7};
anova2(table1matrix, 2)
figure;
boxplot(table1matrix,{'20°C', '30°C', '40°C', '50°C', '60°C', '70°C'})
xlabel('Operating Temperature');
ylabel('Power Output (w)');
title('Box Plot of Power Output at Different Operating Temperatures');
I've already got the graph for the interaction but getting the individual one is confusing me. Any help would be greatly appreciated. Thank you.

Note: This is the code used for the figure. (I am not using the same data, just trying to understand the code and apply it to mine)
bpdata = [];
for i = 1:max(Q2.PATIENT) %assuming patient numbers are 1:max
bpdata = [bpdata, Q2{Q2.PATIENT==i,3:8},nan(size(unique(Q2.TREAT)))];
end
figure()
boxplot(bpdata)
arrayfun(@xline,7:7:size(bpdata,2))
xlabel('6 treatment times across 11 patients')
ylabel('measurement value')
title('Data pooled between treatment factors')
set(gca,'XTick', [])
(Courtesy of Adam Danz)
3 Comments
dpb
on 18 Jul 2024
I am having a hard time trying to figure out the question...
Nishaal
on 18 Jul 2024
dpb
on 18 Jul 2024
I don't see how it has anything to do with your current dataset??? It's building a columnar dataset by some grouping variable in a totally different dataset.
What, precisely, are you trying to plot from your current data?
Accepted Answer
More Answers (0)
Categories
Find more on Repeated Measures and MANOVA in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

