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,logFor distribution functions:
q,lower.tail,log.pFor quantile functions:
p,lower.tail,log.pFor random numbers:
n(except for hypergeometric distributions, wherenis renamed tonn)
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.”
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access