How to define a variable as an ordered factor for mixed effect model?

3 次查看(过去 30 天)
Hello,
I am trying to run the mixed effect model below:
mod = 'y ~ 1 + context + rep + lat + context:rep + (1|name)'; mdl = fitlme(b,mod);
Right now, 'rep' is an ordinal variable with values of 1,2,3 or 4. The model output gives me coefficient values for each value of 'rep' for the fixed effect of 'rep' and one for each value of 'rep' and its interaction with 'context' (which only has two levels). This is not what I want though. I would like the mixed effect model to consider it as an ordered factor (analogy to R) and give me one coefficient for the fixed effect of 'rep' and one coefficient for its interaction with 'context'.
Do you know how I could do that?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Particle & Nuclear Physics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by