Distributions in R - dummies

By Joseph Schmuller

The normal distribution family is one of many distribution families baked into R. Dealing with these families is intuitive. Follow these guidelines:

  • Begin with the distribution family’s name in R (norm for the normal family, for example).
  • To the beginning of the family name, add d to work with the probability density function. For the probability density function for the normal family, then, it’s dnorm().
  • For the cumulative density function (cdf ), add p (pnorm(), for example).
  • For quantiles, add q (qnorm(), which in mathematical terms is the inverse of the cdf ).
  • To generate random numbers from a distribution, add r. So rnorm() generates random numbers from a member of the normal distribution family.

The complex relationship between x and f(x) is eq08001

If you supply values for μ (the mean), Σ (the standard deviation), and x (a score), the equation gives you back a value for f(x), the height of the normal distribution at x. π and e are important constants in mathematics: π is approximately 3.1416 (the ratio of a circle’s circumference to its diameter); e is approximately 2.71828. It’s related to something called natural logarithms and to numerous other mathematical concepts.