Hi Dominik,
To analyze the differences between the "Placebo" and "Control" groups on the second day using repeated measures ANOVA, you need to ensure that your within-subjects design and between-subjects factors are correctly specified. With the additional factors like 'sex' and 'age', you can include them as covariates in your model.
% Sample data setup
Group = {'Placebo'; 'Placebo'; 'Control'; 'Placebo'; 'Control'; 'Placebo'; 'Placebo'; 'Placebo'; 'Control'; 'Placebo'; 'Control'; 'Placebo'};
day1_1 = [12.023; 11.806; 11.763; 11.703; 11.558; 13.633; 12.374; 11.476; 12.496; 12.659; 11.611; 12.524];
day1_2 = [12.719; 12.186; 12.008; 11.678; 12.696; 13.253; 12.410; 11.564; 10.661; 12.863; 11.447; 13.700];
day2_1 = [12.110; 12.788; 11.481; 12.073; 13.692; 11.347; 11.490; 12.542; 12.199; 11.844; 12.838; 11.772];
day2_2 = [12.554; 12.164; 13.325; 12.234; 12.732; 12.432; 11.457; 11.112; 12.382; 11.799; 12.592; 11.387];
sex = {'M'; 'F'; 'M'; 'F'; 'M'; 'F'; 'M'; 'F'; 'M'; 'F'; 'M'; 'F'};
age = [30; 32; 28; 35; 40; 29; 31; 33; 37; 34; 36; 38];
% Create a table
t = table(Group, day1_1, day1_2, day2_1, day2_2, sex, age);
% Define the within-subjects design
WithinDesign = table({'day1'; 'day1'; 'day2'; 'day2'}, {'before'; 'after'; 'before'; 'after'}, ...
'VariableNames', {'Day', 'Time'});
% Fit the repeated measures model
rm = fitrm(t, 'day1_1-day2_2 ~ Group + age + sex', 'WithinDesign', WithinDesign);
% Perform repeated measures ANOVA
tbl = ranova(rm);
% Display the results
disp(tbl);
This setup should allow you to investigate the interaction effects and main effects of the treatments, while accounting for covariates like age and sex. Adjust the data and factors as necessary to fit your actual dataset.