fitlm okay but warnings for anova

조회 수: 4 (최근 30일)
alpedhuez
alpedhuez 2020년 12월 18일
댓글: Walter Roberson 2020년 12월 19일
I run
tbl=fitlm(x,y)
and it does not have any error message.
But when I do
anova(tbl)
I get an error message
warning: Matrixis close to singlular or badly scaled
How come?
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 12월 18일
The design matrix is factored using qr. The message about close to singular will appear (after several steps) in the case that
inv(R)' * inv(R)
has less than full rank.
This matrix becomes the Coefficient Covariance matrix.
At the moment I have no idea what this implies about the data or the model -- this is as far as I have chased back the cause of the warning message.
alpedhuez
alpedhuez 2020년 12월 18일
Yes but why for anova not for fitlm?

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

채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 19일
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.
  댓글 수: 2
alpedhuez
alpedhuez 2020년 12월 19일
So does it mean that the regression is 'fine' as long as fitlm does not return warnings?
Walter Roberson
Walter Roberson 2020년 12월 19일
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.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Analysis of Variance and Covariance에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by