>>>>> "CM" == Carmen Meier <[EMAIL PROTECTED]> >>>>> on Fri, 08 Jun 2007 19:31:49 +0200 writes:
CM> Hi to all, maybe the last question was not clear enough. CM> I did not found any hints how to decide whether it CM> should use lower.tail or not. As it is an extra CM> R-feature ( written in CM> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66250.html CM> ) I do not find anything about it in any statistical CM> books of me. Yes, most "statistical books" do not consider numerical accuracy which is the real issue here. Note that R is much more than a "statistical package" and hence to be appreciated properly needs much broader (applied) mathematical, statistical and computer science knowledge ;-) When p ~= 1, '1 - p' suffers from so called cancellation ("Numerical analysis 101"). If you already know that you will use "q := 1 - p", rather compuate 'q' directly than first compute p, then 1-p, losing all accuracy. All of R's p<foo>(..) functions have an argument 'lower.tail' which is TRUE by default, since after all, p<foo>(x) = Prob_{<foo>}[X <= x] measures the probability of the lower or left tail of the <foo>-distribution. <foo> = norm is just a special case. If you really want q = 1 - p<foo>(x) = Prob_{<foo>}[X > x] then you can get this directly via q <- p<foo>(x, lower.tail = FALSE, ....) Simple example with R : > pnorm(10) [1] 1 > 1 - pnorm(10) [1] 0 > pnorm(10, lower.tail=FALSE) [1] 7.619853e-24 Regards, Martin Maechler, ETH Zurich ______________________________________________ R-help@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 and provide commented, minimal, self-contained, reproducible code.