Mixed terms and fitlmematrix

4 次查看(过去 30 天)
Andrew
Andrew 2013-10-18
回答: Peng Li 2020-8-7
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

回答(1 个)

Peng Li
Peng Li 2020-8-7
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.

类别

Help CenterFile Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by