[R] How to change the significant codes default?
Uwe Ligges
ligges at statistik.uni-dortmund.de
Sun Nov 21 17:26:23 CET 2004
(Ted Harding) wrote:
> 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!)
Ted, it "clashes"! Functions in the namespace are looked up at first.
Uwe
> If your friend wants to use this new definition all the time,
> then one way to arrange this is to put the revised function
> definition (as in the edited file) into his .Rprofile,
> or put the command
> source("printCoefmat")
> into that file.
>
> Best wishes,
> Ted.
>
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
> Fax-to-email: +44 (0)870 094 0861 [NB: New number!]
> Date: 20-Nov-04 Time: 19:13:23
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list