fitglme error says data is not full rank, but it is.

Hi,
I'm trying to fit a glme to this data (there are over 600 rows).
The line of code looks like this:
glme = fitglme(TABLE,'X ~ A + B + C + D + E + F + G + H + I + J + K + (1|ID)','Distribution','Binomial')
It returns the following error:
Fixed Effects design matrix X must be of full column rank.
However, when I check the rank of the matrix, it is full rank:
>> test=table2array(TABLE);
>> rank(test)
ans =
13
>> size(test,2)
ans =
13
So I'm quite puzzled, it is the first time I try a glme using Matlab instead of R...

 채택된 답변

Jeff Miller
Jeff Miller 2020년 10월 6일

0 개 추천

I'm guessing: (1) your ID column is a unique identifier rather than an actual numerical predictor value, and (2) you only have one row for each value of ID.
If those two guesses are right, then you should omit the (1|ID) term from the model. That term tells fitglme to set up dummy variables to code that column, and the predictor matrix with these dummy variables is not full rank if you only have one row for each value of ID.
HTH

댓글 수: 4

Both of your two guesses are correct.
However, omitting (1|ID) and removing ID from the table didin't work. I've also checked that the table doesn't have any other variable other than the ones I'm using, and ther's no NaN values.
Oh, sorry that wasn't helpful, and now I can't really think what the problem might be. Speculating wildly, it might be informative to look at the correlation matrix of columns A-K, and/or a principal components analysis of those columns. Perhaps fitglme checks rank with a different tolerance than rank's default and the predictor matrix is near enough to singular for fitglme to complain.
That seems to be the issue. It works now. Thanks a lot.
Hi Luis
I have a similar problem when running fitglme. how do you please fix thi problem? Thanks.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Tables에 대해 자세히 알아보기

질문:

2020년 10월 6일

댓글:

2022년 3월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by