Common Distribution-Type Arguments

Almost all the R functions that generate values of probability distributions work the same way. They follow a similar naming convention:

  • Probability density functions (PDFs) begin with d.[46]

  • Distribution functions begin with p.

  • Quantile functions begin with q.

  • Random number generators begin with r.

Similarly, most types of functions share certain common arguments:

  • For density functions: x, log

  • For distribution functions: q, lower.tail, log.p

  • For quantile functions: p, lower.tail, log.p

  • For random numbers: n (except for hypergeometric distributions, where n is renamed to nn)

This might make it easier to remember which function to use for which application, and which arguments you need to specify. Of course, you can always just look up the right function to use in R’s help system. Or in this book.

[46] For discrete distributions, these are technically probability mass functions (PMFs), though the function names still begin with “d.”

Get R in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.