[R] show numbers not rounded

Martin Maechler maechler at stat.math.ethz.ch
Fri Feb 28 15:58:02 CET 2003


>>>>> "GS" == Gavin Simpson <gavin.simpson at ucl.ac.uk>
>>>>>     on Fri, 28 Feb 2003 13:42:21 -0000 writes:

    GS> format.pval() as in:
    GS> format.pval(1-pf(((RSSred-RSSful)/2)/(RSSful/(34-3)),2,34-3),digits = 5)

    GS> see ?format for more information

and if you want to make sure not to suffer from unnecessary
precision cancellation, 
use
	pf(S, df1,df2,  lower.tail = FALSE)
instead of
	1 - pf(S, df1,df2,  lower.tail = FALSE)

E.g.

  > pf(180, 2,31, lower.tail = FALSE)
  [1] 8.656982e-18
  > 1 - pf(180, 2,31)
  [1] 0

Martin Maechler <maechler at stat.math.ethz.ch>	http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum  LEO C16	Leonhardstr. 27
ETH (Federal Inst. Technology)	8092 Zurich	SWITZERLAND
phone: x-41-1-632-3408		fax: ...-1228			<><


    GS> -----Original Message-----
    GS> From: r-help-admin at stat.math.ethz.ch [mailto:r-help-admin at stat.math.ethz.ch]
    GS> On Behalf Of Christoph Lehmann
    GS> Sent: 28 February 2003 13:18
    GS> To: r-help at stat.math.ethz.ch
    GS> Subject: [R] show numbers not rounded


    GS> how can I show an number not rounded, but in the format, eg. x.xxxx 

    GS> e.g. 
    >> signif(1-pf(((RSSred-RSSful)/2)/(RSSful/(34-3)),2,34-3),digits = 5)

    GS> shows
    GS> [1] 0

    GS> but I need something like

    GS> [1] 2.2e-16


    GS> thanks
    GS> christoph
    GS> -- 
    GS> Christoph Lehmann                            Phone:  ++41 31 930 93 83 
    GS> Department of Psychiatric Neurophysiology    Mobile: ++41 76 570 28 00
    GS> University Hospital of Clinical Psychiatry   Fax:    ++41 31 930 99 61 
    GS> Waldau                                            lehmann at puk.unibe.ch 
    GS> CH-3000 Bern 60            http://www.puk.unibe.ch/cl/pn_ni_cv_cl.html




More information about the R-help mailing list