Matlab's fitrm function must have full column rank

12 views (last 30 days)
Ryan
Ryan on 5 Aug 2014
Edited: Timo on 13 Aug 2014
Thanks in advance for the help.
I am trying to create a repeated measures model. I have a table with several response variables and several predictor variables. I created a model using Wilkinson notation then passed my table with the model to fitrm.
mdl = fitrm(t,model);
I am getting the following error.
Error using RepeatedMeasuresModel.fit (line 1331) The between-subjects design must have full column rank.
Error in fitrm (line 67) s = RepeatedMeasuresModel.fit(ds,model,varargin{:});
What exactly does this error mean? When I change my model to 'response ~ 1' (in addition to a few others I have found) fitrm runs just fine. I am fairly certain that my problem then has to be either with my formulation of the model, or (what I think is the problem) there is something wrong with my table.
The error itself hints to me that the rank of my table (if I were to convert to a matrix) is not full. However, I have checked to make sure that neither my rows nor my columns are linearly independent. In particular, I isolated two features, lets call them x and y, that when present give me the above error. When I use either
model = 'response ~ y'
or
model = 'response ~ x'
I get no error. When I use
model = 'response ~ y + x
I get the above error. y and x are linearly independent. What could possibly be going on here?
  3 Comments
Ryan
Ryan on 13 Aug 2014
Try the dummy encoding your data by hand then find the rank of the resulting matrix. What was happening with me was that each one of my features was linearly independent, but after I dummy encoded my features, there was linear dependence among the dummy features. If the rank of the dummy matrix you create is less than the number of dummy features in the matrix you have the same problem I had. I had to write code to find and remove linear dependent dummy features (you know from the rank and the number of dummy features how many dummy features must be removed to make your dummy encoded features linearly independent; the trick is to find which ones they are).
Timo
Timo on 13 Aug 2014
Edited: Timo on 13 Aug 2014
Thank you Ryan.
I used the teg_repeated_measures_ANOVA toolbox for my dataset and that worked fine.
I will look into the linear dependence. Still, it's would be bad if the example from Matlab itself has this problem, right?
Timo

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!