[R] pnorm how to decide lower-tail true or false

Robert A LaBudde ral at lcfltd.com
Fri Jun 8 19:54:56 CEST 2007


At 01:31 PM 6/8/2007, Carmen wrote:
>Hi to all,
>maybe the last question was not clear enough.
>I did not found any hints how to decide whether it should use lower.tail
>or not.
>As it is an extra R-feature ( written in
>http://finzi.psych.upenn.edu/R/Rhelp02a/archive/66250.html )
>I do not find anything about it in any statistical books of me.
>Regards Carmen

pnorm(z, lower.tail=TRUE) (the R default) gives the probability of a 
normal variate being at or below z. This is the value commonly called 
the cumulative distribution function at the point z, or the integral 
from -Inf to z of the gaussian density.

pnorm(z, lower.tail=FALSE) gives the complement of the above, or 1 - 
cdf(z), and is the integral from z to Inf of the gaussian density.

E.g.,

 > pnorm(1.96, lower.tail=TRUE)
[1] 0.9750021
 > pnorm(1.96, lower.tail=FALSE)
[1] 0.02499790
 >

Use lower.tail=TRUE if you are, e.g., finding the probability at the 
lower tail of a confidence interval or if you want to the probability 
of values no larger than z.

Use lower.tail=FALSE if you are, e.g., trying to calculate test value 
significance or at the upper confidence limit, or you want the 
probability of values z or larger.

You should use pnorm(z, lower.tail=FALSE) instead of 1-pnorm(z) 
because the former returns a more accurate answer for large z.

This is really simple issue, and has no inherent complexity 
associated with it.
================================================================
Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: ral at lcfltd.com
Least Cost Formulations, Ltd.            URL: http://lcfltd.com/
824 Timberlake Drive                     Tel: 757-467-0954
Virginia Beach, VA 23464-3239            Fax: 757-467-2947

"Vere scire est per causas scire"



More information about the R-help mailing list