Mixed terms and fitlmematrix

4 visualizaciones (últimos 30 días)
Andrew
Andrew el 18 de Oct. de 2013
Respondida: Peng Li el 7 de Ag. de 2020
Hi all,
I'm trying to create a linear mixed effect model where I have three fixed effects (X1, X2, X3) and one random effect (Z1) using fitlmematrix.m.
The issue I'm having is that I'm not sure how to get results for "mixed" terms, i.e. X1*X2, X2*X3, X1*X2*X3. When I look up the help for the linear mixed model class I can see the "Formula" member, but I'm not sure how to specify it when calling fitlmematrix.m.
I'm under the impression that LMMs handle mixed terms differently to including them directly in the system matrix (i.e. creating X4 = X1*X2 etc).
Any help on how to get the mixed terms into the model would be greatly appreciated, Andrew

Respuestas (1)

Peng Li
Peng Li el 7 de Ag. de 2020
For new versions of MATLAB, you can use fitlm, fitlme, fitglme which allows table input, and allows formulas.
But if you use fitlmematrix, you can generate the interaction items manually but timing the two variables, or three variables together. You may need to center the continuous variables in order for a 'meaningful' results.

Community Treasure Hunt

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

Start Hunting!

Translated by