How to fit a general-linear mixed-effects model with categorical variables?

8 vues (au cours des 30 derniers jours)
Falk Lieder
Falk Lieder le 5 Oct 2015
Modifié(e) : Falk Lieder le 6 Oct 2015
Hi,
I am using the function fitglme from the statistics toolbox to fit a mixed-effects model with repeated measurements and categorical predictor variables as follows:
data_nr_acquisitions=table(nr_acquisitions,problem_type,block,subject);
%mixed-effects GLM that allows the effects of the problem type, the offset, and the
%block to vary randomly between subjects.
glme = fitglme(data_nr_acquisitions,'nr_acquisitions ~ problem_type + block + (problem_type| subject) + (block| subject) + (1|subject)');
anova(glme)
The variable problem_type is categorical, but when I run anova it says that problem_type has only one degree of freedom even though it has four possible values. This suggests that Matlab is treating it as a continuous regressors rather than as a categorical variable. Hence, something went wrong.
I tried to instruct fitglme to treat problem_type as a categorical variable with the argument "CategoricalVars" but unlike fitglm the function fitglme does not accept this argument. Can fitglme handle categorical variables and how can I get it to treat a variables as categorical?
  2 commentaires
Falk Lieder
Falk Lieder le 6 Oct 2015
I have added an explanation of the error. Please reopen my question or tell me what else I need to specify in order for my question to be answerable.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Get Started with Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by