Sunday, February 03, 2013

Family of density functions in R

There is a family of density functions in R. Their names follows this pattern:

d<distribution name>

For example: dnorm, dbinom etc.

Now when do we need such functions?

Whenever

  • you know your target distribution and 
  • you know its distribution parameters and 
  • you want to know the probability of occurrence of an input.
For example
  • you know that it is Normal distribution and
  • you know that its Mean is 0 and SD is 1 and
  • you want to know the probability of occurrence of -0.5555556 then
  • invoke dnorm(c(-0.5555556),mean=0,sd=1)
Nice.