fitlm okay but warnings for anova

2 views (last 30 days)
I run
and it does not have any error message.
But when I do
I get an error message
warning: Matrixis close to singlular or badly scaled
How come?
alpedhuez on 18 Dec 2020
Yes but why for anova not for fitlm?

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 19 Dec 2020
fitlm() calculates the CoefficientCovariance matrix based upon the inverse of the R of the qr decomposition of the design matrix. The R term (and so its inverse) has full rank (such as 5), but the CoefficientCovariance matrix does not always come out as full rank. fitlm() does not have a specific test to warn you that the coefficient covariance matrix is not full rank, and fitlm does not use the coefficient covariance matrix in any of its own calculations, so there is no warning during the fitlm phase.
anonva() pulls out the CoefficientCovariance matrix calculated by fitlm and uses it in calculating ss in getTermSS1() . However when it is not full rank, then the warning message is generated about matrix being singular.
I am not familiar with the anova algorithm, so I do not know what "ss" means for an anonova calculation; I also do not have the background to interpret the physical meaning of the CoefficientCovariance matrix that filtlm() calculates. So the above just tells you about the mechanics of how the message is generated, not the physical interpretation of when it occurs.
Walter Roberson
Walter Roberson on 19 Dec 2020
I have not studied regression, so I do not know. Generally speaking, there are some linear algebra and statistics calculations that do not generate warnings because the calculations are deterministic, but for which it is the user's responsibility to check the results for suitability for the purposes they want.
For example there are calculations that mathematically involve division by the determinant, but it is not the responsibility of det() to produce a warning when det() finds that the result is 0.

Sign in to comment.

More Answers (0)


Community Treasure Hunt

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

Start Hunting!