4. Probability Distributions: Practical 4
Introduction
Objectives
Learn how to do the following in R
- calculate probabilities for a normal random variable, using the commands dnorm, pnorm & qnorm
- calculate probabilities for a bionomial random variable, using the commands dbinom, pbinom & qbinom
- make probability statements about data with a normal or binomial distribution
Instruction
- Read through the text below
- Execute code-examples and compare your results with what is explained in the text
- Make the exercises
- Time: +/- 180 minutes in total
In this computer practical, you will learn how to generate random variables from different distributions. You can use this knowledge to answer all sorts of questions about the probability that an event occurs. We will discuss how to calculate the probability density, cumulative probability and the inverse cumulative density (quantiles). Luckily, R has some standard functions that can help you with these calculations. These functions start with the letters d*, p* and q*, followed by a short name for the distribution you are using. For the normal distribution (sometimes also called Gaussian distribution) this will result in the functions dnorm, pnorm and qnorm and for the binomial distribution we have dbinom, pbinom and qbinom. In R this information (and more) can be found by typing:
?Distributions