On 20-Nov-04 Uwe Ligges wrote:
Shigeru Mase wrote:
Dear R experts,
I am posting this question on behalf of a Japanese R user
who wants to know how to change the siginificant codes default.
As you know, R's default significant codes are:
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
But he says that it is usual in economics to give codes such as
`***' for 0.01, `**' for 0.05 and `*' for 0.10
I don't know if this is true (common) or not, but what I as well
as he are puzzled is that, apparently, there is no part in the code,
say that of summary.lm, which produces these significant codes
as well as the annotation above. A quick search of "rking" using
keywords "significant codes star" gave me no information.
Thanks in advance.
For example, calling summary(lmObject) dispatches on method
summary.lm()
hwich creates an object of class "summary.lm".
The latter is printed by method print.summary.lm() which calls
printCoefmat().
The stars are hard-coded there, and I don't think anybody is going to
change that. I suggest to turn of the printing of siginificant codes by
specifying
print(summary(.....), signif.stars = FALSE)
or by setting the corresponding option().
Uwe Ligges
It would be possible to re-define 'printCoefmat' privately
so as to change the lines
cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
symbols = c("***", "**", "*", ".", " "))
towards the end of its code into whatever you prefer, e.g.
cutpoints = c(0, 0.01, 0.05, 0.1, 1),
symbols = c("***", "**", "*", " "))
or
cutpoints = c(0, 0.001, 0.01, 0.05, 0.1, 1),
symbols = c("****", "***", "**", "*", " "))
(both of which are compatible with your description of what
is needed).
The most straightforward way of redefining it is to copy
the code for 'printCoefmat' into a file, e.g.
sink("printCoefmat.R")
printCoefmat
sink()
and then edit that file.
NOTE that the code written to the file does not include
the name of the function, i.e. it starts
function (x, digits = max(3, getOption("digits") - 2),....
so the first modification has to be
printCoefmat<-function(x, digits = .... )
Then, when you want your private version, simply do
source("printCoefmat.R")
and it will overlay the original version. (Experts will have
to advise whether this clashes with any "namespace" issues.
On my reading of the code, it doesn't seem to; but I'm no
expert!)