Perform repeated ANOVA on one group

조회 수: 48 (최근 30일)
elevada
elevada 2023년 10월 25일
답변: Shivansh 2024년 1월 3일
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
Scott MacKenzie
Scott MacKenzie 2023년 10월 25일
Yes, you can use ranova. Post your data and I (or someone) will demo how.

댓글을 달려면 로그인하십시오.

답변 (1개)

Shivansh
Shivansh 2024년 1월 3일
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!

카테고리

Help CenterFile Exchange에서 Repeated Measures and MANOVA에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by