Azzera filtri
Azzera filtri

Perform repeated ANOVA on one group

22 visualizzazioni (ultimi 30 giorni)
elevada
elevada il 25 Ott 2023
Risposto: Shivansh il 3 Gen 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 Commento
Scott MacKenzie
Scott MacKenzie il 25 Ott 2023
Yes, you can use ranova. Post your data and I (or someone) will demo how.

Accedi per commentare.

Risposte (1)

Shivansh
Shivansh il 3 Gen 2024
Hi Elevada,
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.
Refer to the following links for more information about "fitrm" and "ranova":
If you are still facing the same issue, kindly share more details regarding the data and the code file.
Hope it helps!

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by