Bug 16166 - inconsistent results of zapsmall called by Thin.row (especially in anova.mlm)
Summary: inconsistent results of zapsmall called by Thin.row (especially in anova.mlm)
Status: NEW
Alias: None
Product: R
Classification: Unclassified
Component: Analyses (show other bugs)
Version: R 3.1.2
Hardware: x86_64/x64/amd64 (64-bit) Windows 64-bit
: P5 major
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2015-01-22 11:10 UTC by florent aubry
Modified: 2015-01-26 15:28 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description florent aubry 2015-01-22 11:10:15 UTC
Let us consider the Dalgaard's example given in utils::example( SSD). Clearly such a comparison:

anova( mlmfit, mlmfit0, idata=D.idata, X=~ deg * noise, M=~ deg * noise)

cannot be performed because X and M span the same space and, consequently, T is void. Nevertheless, although the writing is equivalent, this comparison
 
anova( mlmfit, mlmfit0, idata=D.idata, X=~ deg * noise)

gives the following wrong result:

Analysis of Variance Table

Model 1: reacttime ~ 1
Model 2: reacttime ~ 1 - 1

Contrasts orthogonal to
~deg * noise

  Res.Df Df   Gen.var.  Pillai approx F num Df den Df    Pr(>F)    
1      9    1.2185e-29                                             
2     10  1 2.4231e-29 0.99141   76.902      6      4 0.0004381 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

In the first case, identical( proj( X), proj( M)) is TRUE whereas in the second analysis, this assertion is FALSE. Consequently, if in the first case, the rounding done by zapsmall leads to 0, zapsmall returns some not null (very low) values in the second case. Then Thin.row does not return a NULL matrix.
Comment 1 Duncan Murdoch 2015-01-24 12:59:53 UTC
Please simplify your example.  If this is a problem with zapsmall, you shouldn't need to involve examples, anova, etc.  Just put together an input to zapsmall that gives the wrong answer.
Comment 2 florent aubry 2015-01-26 15:28:21 UTC

(In reply to Duncan Murdoch from comment #1)
> Please simplify your example.  If this is a problem with zapsmall, you
> shouldn't need to involve examples, anova, etc.  Just put together an input
> to zapsmall that gives the wrong answer.

The purpose ot the example was to emphasize the inconsistent call of zapsmall in stats:::Thin.row using an example for which the maximum of the values to be rounded (i.e., X) is lower than the tolerance of the error (tol).