Simple effects following fitlme

15 views (last 30 days)
Avijit Chowdhury
Avijit Chowdhury on 2 May 2024
Answered: Akash on 14 May 2024
I am fitting a linear mixed effects model as below:
results = fitlme(temp,'deltaRSFC~ Drug*Time*pre_SHAPS+Age+Sex+Site+(1|Subj)','DummyVarCoding','reference','FitMethod','REML');
where both Drug and Time are categorical with each having two levels.
Following significant Drug*Time interaction, how do I test post-hoc test of simple effects. I.e., how do I test whether the effect of Time is significant only for a specific level of the factor Drug (e.g. Drug A (Time1 - Time2))?
I searched a lot of posts but the coefTest guidance is not clear. Any help is much appreciated.

Answers (1)

Akash
Akash on 14 May 2024
Hi Avijit,
You can use the `coefTest` function, which allows to test the significance of specific effects within the model. You will need to construct a contrast vector that represents the coefficients for 'Time' within each level of 'Drug' (e.g., 'Drug A' and 'Drug B') as they appear in the model's output.
For information on setting up contrasts in models with interaction effects, the following MATLAB Central discussion links will be useful. They provide details on how to define the contrast matrix for the interaction term to test:-
You can also utilize the 'emmeans' function available on MATLAB File Exchange, which provides the predicted means from generalized linear mixed effect models in Matlab:-

Community Treasure Hunt

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

Start Hunting!