/
Mixed Model with MATLAB
Mixed Model with MATLAB
Example
migraines interictal: subjects 1,2,3,4,5,6,7,8
migraine prodrome: subjects 1,2,9,10,11,12
So there are two subjects that have data in both conditions and I just want to see if the groups are different
Create Excel file with variables
The outcome (dependent) variable can be "Y", then a single variable for group and variables for each subject.
For simplicity, save as "T.xlsx"
Import as a Table into MATLAB
- Select T.xlsx
- Change group and subject variable types to "Categorical"
- Set variable names to first row, import as table (both default), then select the numeric data (not 1st row), and "Import Selection"
- This will import the data into a table "T" (name is based on the Excel filename). You can check by typing "T" at the command prompt, or looking at the workspace:
Create a mixed effects model
>> lme = fitlme(T,'Y~Interictal+(1|Subject1)+(1|Subject2)')
The "T" is the table just imported.
The formula is based on the variable names in the table. "Y" is the output variable, and "Y~Interictal" indicates treating the group variable "Interictal" as a fixed effect. Each "1|Subject1" indicates that the variable "Subject1" is a random effect. The output gives assessment of the model:
, multiple selections available,
Related content
Repeated Measures ANOVA
Repeated Measures ANOVA
More like this
Archive - old design matrix and contrast files
Archive - old design matrix and contrast files
More like this
One-sample t-test
One-sample t-test
More like this
Statistics
Statistics
More like this
SPM - Standard SPM Tools
SPM - Standard SPM Tools
More like this
Direction and Effect Size
Direction and Effect Size
More like this