fitlm okay but warnings for anova

1 回表示 (過去 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 Center および File ExchangeAnalysis 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