[R] calculate probability

(Ted Harding) ted.harding at wlandres.net
Sat Nov 6 13:06:22 CET 2010


On 06-Nov-10 11:16:28, Jumlong Vongprasert wrote:
> Dear All
> I have some problem with calculate probability.
> Assume I have data with normal distribution with mean = 5 sd = 2.
> I want to approximate probability = 2.4.
> I used pnorm(2.4, 5, 2) - pnorm(2.4, 5, 2, lower.tail = FLASE),
> correct or not.
> Many Thanks
> Jumlong

[A]
Not correct because "FLASE" should be "FALSE".

[B]
Not correct because
a) pnorm(2.4, 5, 2) is the probability that a value from a Normal
distribution with mean 5 will be less than 2.4, and this is less
than 1/2 (since 2.4 is less than the mean).
b) pnorm(2.4, 5, 2, lower.tail = FALSE) is the probability that
such a value will be greater than 2.4, and this is greater than 1/2
(for the same reason.
c) The difference will therefore be (< 1/2) - (> 1/2) which will
be less than 0, so cannot be a probability.

[C]
Not correct because a value sampled from a Normal distribution
(which is a continuous distribution) has probability 0 of being
exactly equal to any given value (e.g. 2.4); so I think your
question does not express what you want to know.

One possibility which could make your question realistic is
that the value "2.4" that you are interested in is a value
sampled from Normal(mean=5, sd=2) **that has been rounded to
1 decimal place** and so could have been any value between
2.35 and 2.45; in that case it makes sense to ask what is the
probability of a value in this range from Normal(mean=5, sd=2).

This would be

  pnorm(2.45, 5, 2) - pnorm(2.35, 5, 2) = 0.008569045

Of course, the degree of rounding may be different -- for
example rounding to *even* values of the first decimal place,
i.e. to values ... , 2.0, 2.2, 2.4, 2.6, 2.8, ...
in which case the event whose probability you want is that
the sampled value is between 2.3 and 2.5, whose probability is

  pnorm(2.5, 5, 2) - pnorm(2.3, 5, 2) = 0.01714178

Since the question you are really interested in cannot be
identified from what you have asked (see examples above),
you should try to make your question clear and definite!

Hoping this helps,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <ted.harding at wlandres.net>
Fax-to-email: +44 (0)870 094 0861
Date: 06-Nov-10                                       Time: 12:06:17
------------------------------ XFMail ------------------------------



More information about the R-help mailing list