fitglme gives rank deficit error while fitglm does not.

6 views (last 30 days)
Dear all,
When I try to fit a model using fitglme with a model specification extracted from stepwise regression plus a random effect (1|ID), I receive the following error message: "Fixed Effects design matrix X must be of full column rank."
I removed the random effect from the formula, but the error still occurred while fitglm returns no error.
If fitglme without random effects must be the same as fitglm, then there must be a problem with fitglme as this error has been reported by others here and here.
Your advice on dealing this error would be greatly appriciated.
The second question is that if there is any way to include the random effect directly in the stepwiseglm.
Thanks in advance!

Answers (1)

Mostafa
Mostafa on 14 Apr 2022
I figured out why a model specification worked in fitglm, but not in fitglme even without random effect. Many others also had the same problem of rank deficit error in Fitlme and their questions were not answered.
The problem is that glmfit and lmfit drop the problematic terms automatically but glmfite and lmfite do not.
So the solution will be to run the same model specification without random effects in glmfit or lmfit and see if it works. If this is the case, then at least one term will have been dropped whose estimate is 0 and whose tstat and pValue equal NaN.
That term is the problematic one and you need to drop it manually before running fitglme or lmfite.

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!