Each distribution is indicated by a root name. e.g. root name for normal distribution is norm. Other root names are such as binom, chisq, f, t, unif
Every distribution has four functions - p: probability (cdf) - q: quantile (inverse cdf) - d: density (pdf) - r: random (random variable having the specified distribution)
Suppose we want to draw 10 values of \(\epsilon\) such that \(\epsilon\) follows \(N(0,1)\).
rnorm(10, mean = 0, sd = 1) #default is mean = 0, sd = 1
## [1] -1.51529999 -0.74485646 -1.63128535 2.12696297 1.11253449 -0.38689266
## [7] -1.32032530 0.06151038 0.17386704 -1.58817369
It is known that 95% of the area under the normal distribution lies within 1.96 standard deviations away from the mean. We can see this by plugging in the cumulative probability to function q of root norm.
c <- qnorm(p = c(0.025,0.975))
print(c)
## [1] -1.959964 1.959964
We can confirm the cumulative probability of c by using function p.
pnorm(c)
## [1] 0.025 0.975