# Perform repeated ANOVA on one group

22 Ansichten (letzte 30 Tage)
elevada am 25 Okt. 2023
Beantwortet: Shivansh am 3 Jan. 2024
Hello,
Can we use Repeated measure ANOVA for a single group of few subjects having measurement at 3 different time points?It seems that this is an indication of this type of test and i found examples in python but with Matlab ranova if the predictors are all different it returns Nan? Should I just use anova1 to compare 3 points?
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Scott MacKenzie am 25 Okt. 2023
Yes, you can use ranova. Post your data and I (or someone) will demo how.

Melden Sie sich an, um zu kommentieren.

### Antworten (1)

Shivansh am 3 Jan. 2024
I understand that you are trying to use repeated measure ANOVA for a single group of a few subjects having measurement at three different time points.
In MATLAB, we can use “fitrm” to fit the repeated model first and then use the “ranova” function to perform the ANOVA.
Please refer to the below example code for a detailed idea of the above approach.
% data for 10 subjects measured at 3 time points
data = array2table(rand(10, 3), 'VariableNames', {'Time1', 'Time2', 'Time3'});
% Create a within-subjects design table indicating the measurements are repeated
withinDesign = table([1 2 3]', 'VariableNames', {'TimePoints'});
% Fit the repeated measures model
rmModel = fitrm(data, 'Time1-Time3~1', 'WithinDesign', withinDesign);
% Perform the repeated measures ANOVA
rmANOVA = ranova(rmModel);
% Display the results
disp(rmANOVA);
If you are still getting the output as “NaN”, you can check the structure of the data. The presence of a constant column in the dataset can also lead to “NaN” as a result.
The function "anova1" can be used to compare the three time points, but it does not take into account the repeated measures nature of the data. It can eventually fail to provide correct results in this case.
If you are still facing the same issue, kindly share more details regarding the data and the code file.
Hope it helps!
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Repeated Measures and MANOVA finden Sie in Help Center und File Exchange

R2021b

### Community Treasure Hunt

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

Start Hunting!

Translated by