[Rd] printCoefmat(signif.legend =FALSE) (PR#7802)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Thu Apr 21 13:43:08 CEST 2005


On Thu, 21 Apr 2005 wolfgang.lederer at stat.uni-muenchen.de wrote:

> printCoefmat(signif.legend =FALSE) does not work properly. The option
> "signif.legend = FALSE" is ignored as shown in the example below.
>
> cmat <- cbind(rnorm(3, 10), sqrt(rchisq(3, 12)))
> cmat <- cbind(cmat, cmat[,1]/cmat[,2])
> cmat <- cbind(cmat, 2*pnorm(-cmat[,3]))
> colnames(cmat) <- c("Estimate", "Std.Err", "Z value", "Pr(>z)")
>
> # Prints the legend, although it should not
>
> printCoefmat(cmat, signif.stars =TRUE, signif.legend = FALSE)
> #     Estimate Std.Err Z value   Pr(>z)
> #[1,]  10.3567  3.3680  3.0750 0.002105 **
> #[2,]   9.1652  4.3609  2.1017 0.035581 *
> #[3,]  10.4420  3.6527  2.8587 0.004253 **
> #---
> #Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
>
> # Does not print the legend, although it should
>
> printCoefmat(cmat, signif.stars = FALSE, signif.legend = TRUE)
> #     Estimate Std.Err Z value   Pr(>z)
> #[1,]  10.3567  3.3680  3.0750 0.002105
> #[2,]   9.1652  4.3609  2.1017 0.035581
> #[3,]  10.4420  3.6527  2.8587 0.004253
>
>
> I think the problem can be easily solved by changing the code lines (3.
> and 4. from the bottom)
>
> if (signif.stars)
>        cat("---\nSignif. codes: ", attr(Signif, "legend"), "\n")
> to
>
> if (signif.legend)
>        cat("---\nSignif. codes: ", attr(Signif, "legend"), "\n")
>
> At least it works for the more sensibel case, that no legend should be
> produced.

Probably if(signif.stars && signif.legend)  would be most appropriate.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list