[R] How Does One Use the Value of Density Function?

(Ted Harding) Ted.Harding at manchester.ac.uk
Mon Sep 7 11:14:04 CEST 2009


On 07-Sep-09 06:42:06, Gundala Viswanath wrote:
> How do people usually use the result of density function (e.g. dnorm)?
> Especially when its value can be greater than 1.
> 
> What do they do with such density >1?
> 
>> dnorm(2.02,2,.24)
> [1] 1.656498
> 
> - G.V.

The point is that it is a *density* of probability. The greater the
density, the more compactly a given amount of probability is
distributed over a given range of X (or, the narrower the range of
X ove which a given amount of probability is distributed); the lower
the density, the more widely it is dispersed.

The concept of density is, in effect, the amount of probability
per unit length in an interval, so "division by length" is part
of it. To convert probability density to probability, multiply
by a length.

To obtain (a close approximation to) the amount of probability within
a short range, such as 2.01 to 2.03, when X has your Normal distribution
with mean 2.02 and SD 0.24, multiply the value of the density function
at the midpoint 2.02 by the length 0.02 of the interval:

  dnorm(2.02,2,.24)*0.02
  # = 0.03312996

and compare it with the amount of probability calculated from pnorm:

  pnorm(2.03,2,.24) - pnorm(2.01,2,.24)
  # = 0.03312044

The approximation is even closer for shorter intervals. Consider the
ratio between the approximate and the true probabilities for an
interval of length 0.0002:

  (dnorm(2.02,2,.24)*0.0002)/(pnorm(2.0201,2,.24) - pnorm(2.0199,2,.24))
  # = 1

In fact,

  1 - (dnorm(2.02,2,.24)*0.0002)/
      (pnorm(2.0201,2,.24) - pnorm(2.0199,2,.24))
  # = -2.873419e-08

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 07-Sep-09                                       Time: 10:14:00
------------------------------ XFMail ------------------------------




More information about the R-help mailing list