# R-beta: quantile

**Martin Maechler
**
Martin Maechler <maechler@stat.math.ethz.ch>

*Fri, 27 Feb 1998 09:27:02 +0100*

[diverted from R-help to R-devel]
>>>>>* "PD" == Peter Dalgaard BSA <p.dalgaard@biostat.ku.dk> writes:
*
PD> Bill Simpson <wsimpson@uwinnipeg.ca> writes:
>>
>> I do:
>> x<-rnorm(1000)
>> quantile(x,c(.025,.975))
>> 2% 98%
>> -1.844753 1.931762
>>
Yes, this is a pain;
I've known about this for months, and always been too busy / diverted
to fix it..
>> Since I want to find a 95% confidence interval, I take the .025 and .975
>> quantiles. HOWEVER R says I have the 2% (not 2.5%) and 98% (not 97.5%)
>> points. Is it just rounding the printed 2% and 98%, or is it REALLY
>> finding .02 and .98 points instead of .025 and .975?
PD> It's rounding...
PD> At the end of the quantile function, you'll see:
PD> names(qs) <- paste(round(100 * probs), "%", sep = "")
PD> qs
PD> }
PD> Maybe we should put in an extra argument for controlling the precision
PD> of the rounding?
Hmm, I think we agree that we should improve that 'names(gs)..' line.
However, the first step should be to use a much better default than
round(100 * probs)
If the default is ``smart enough'',
maybe we don't really need a new argument
[Can still have one for the ones who really want to fine-tune the names..]
-------------
Some untested proposals for replacement of
round(100 * probs)
1) formatC(100*probs, dig=3, format='f')
2) formatC(100*probs, dig= max(3, .Options$digits - 3), format='f')
3) signif(100*probs, max(3, .Options$digits - 3))
or then replace "max(3, .Options$digits - 3)"
by the new argument 'digits.names'
and have that one default to
digits.names = max(3, .Options$digits - 3)
Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._