1.6 Useful R functions relating to univariate distributions
Table 1.1 summarizes the different functions relating to univariate PMFs and PDFs, using the Binomial and Normal as examples.
Discrete | Continuous | |
---|---|---|
Example: | Binomial(n,\(\theta\)) | Normal(\(\mu,\sigma\)) |
Likelihood function | dbinom | dnorm |
Probability: \(P(Y=y)\) | dbinom | always 0 |
CDF, \(F(y)=P(Y\geq y)=prob\) | pbinom | pnorm |
Inverse CDF, \(F^{-1}(prob)=y\) | qbinom | qnorm |
Generate simulated data | rbinom | rnorm |
Other distributions, such as the t-distribution, the Uniform, Exponential, Gamma, Beta, etc., have their own set of d-p-q-r functions in R.