Clear Filters
Clear Filters

Possible bug in fitrm within subject parameter declaration?

11 views (last 30 days)
Hello,
in building my repeated measures model for a factorial manova experiment (using matlab's manova function), there seems to be an issue when declaring a repeated measures model for the fitrm function. I have tested using the
rank
function the rank of each of the dependent variables and independent variables, and all have results in a rank of greater than 1, thus equalling the number of columns.
However, for some bizzarre reason, when I set up my table using the following code:
t=table(doe_table(1,:)',doe_table(2,:)',doe_table(3,:)',doe_table(4,:)',doe_table(5,:)',doe_table(6,:)',RF,...
VF,QDYN,'VariableNames',...
{'hp','N','Engine','Ncvx','Traj','Wnw','y1','y2',...
'y3'});
...and I declare the fitrm model as:
Name='WithinDesign';
Value=table([1:nc]','VariableNames',{'SolID'}); % nc is the total number of cases/observations in the study, meaing also its the row size of t (the table)
rm = fitrm(t,'y1-y3~hp+N+Engine+Ncvx+Traj+Wnw',Name,Value);
I get the following error with fitrm:
Error using RepeatedMeasuresModel.fit (line 1347)
The between-subjects design must have full column rank.
Error in fitrm (line 77)
s = RepeatedMeasuresModel.fit(ds,model,varargin{:});
Error in manova_test_doe2 (line 32)
rm = fitrm(t,'y1-y3~hp+N+Engine+Ncvx+Traj+Wnw',Name,Value);
Perhaps I am misunderstanding the requirement or perhaps the error is poorly written- because I am fairly sure it is not an issue of column rank. I've gone the extra step to set all NaN values to something that is greater than 0 or completely removed them from the analysis, but that won't do anything as well.

Answers (1)

Pratik
Pratik on 14 May 2024 at 9:52
Hi Alessandro,
As per my understanding, there is an error of full column rank when declaring a repeated measures model for the fitrm function.
This is an expected behavior based on how dummy variables are generated for categorical predictors. MATLAB will generate a unique dummy variable for each category in the categorical predictor. In order to run the repeated measures fit, the number of observations must be at least the number of variables plus one.
For example, one categorical predictor with 'n' categories requires 'n+1' observations. A numerical predictor is considered to be one variable.
Increasing the number of observations should fix this issue.
I hope this helps!

Community Treasure Hunt

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

Start Hunting!