fitlm okay but warnings for anova

1 Ansicht (letzte 30 Tage)
alpedhuez
alpedhuez am 18 Dez. 2020
Kommentiert: Walter Roberson am 19 Dez. 2020
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 Kommentare
Walter Roberson
Walter Roberson am 18 Dez. 2020
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 am 18 Dez. 2020
Yes but why for anova not for fitlm?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 19 Dez. 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.
  2 Kommentare
alpedhuez
alpedhuez am 19 Dez. 2020
So does it mean that the regression is 'fine' as long as fitlm does not return warnings?
Walter Roberson
Walter Roberson am 19 Dez. 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.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by