Specifying a repeated measures model using fitrm

14 views (last 30 days)
Hello,
I'm trying to fit a repeated measures model to a dataset using fitrm, but I'm having a hard time understanding how to specify the model using the help page and examples.
I measured the scalar response FR from 4,894 individuals, termed NEU. I measured FR from each NEU 16 times, while manipulating two variables in a factorial design: CUE (8 categorical values) and STATE (2 categorical values).
Here are the first and last few rows of the table containing the data for clarity:
Using fitrm.m, How can I model the effect of STATE and CUE on FR (FR~CUE*STATE), while accounting for the fact that FR was repeatedly measured from each NEU?

Answers (1)

Sai Pavan
Sai Pavan on 9 Oct 2023
Hi Matt,
I understand that you are trying to model the effect of STATE and CUE on FR as well as account for the fact that FR was repeatedly measured from each NEU.
Please try using the "fitrm" function as given below to model the repeated measures:
rm = fitrm(data, 'FR1-FR16~CUE*STATE', 'WithinDesign', [1 4]);
The FR1-FR16 specifies the repeated measures of FR. The CUE*STATE specifies the fixed effects of CUE and STATE, as well as their interaction. By providing the “WithinDesign” and “[1 4]” parameters to the “fitrm” function, we indicate that the repeated measures are within-subjects factors. In this case, the first index (1) represents the column number of repeated measures of FR, and the second index (4) represents the column number of the subject identifier NEU.
Please refer to the below documentation to learn more about the “WithinDesign parameter in “fitrm function: https://www.mathworks.com/help/stats/fitrm.html#:~:text=WithinDesign%20%E2%80%94%20Design%20for%20within%2Dsubject%20factors
Hope it helps.
Regards,
Sai Pavan

Community Treasure Hunt

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

Start Hunting!