1. Learn
  2. /
  3. Courses
  4. /
  5. Basic Statistics

Exercise

Probability mass and density functions (2)

For continuous variables, the values of a variable are associated with a probability density. To get a probability, you will need to consider an interval under the curve of the probability density function. Probabilities here are thus considered surface areas.

In this exercise, we will simulate some random normally distributed data using the rnorm() function. This data is contained within the data vector. You will then need to visualize the data.

Instructions

100 XP
  • Check the documentation of the the dnorm function using help(dnorm)
  • Now calculate the density of the data vector and store it in a vector called density
  • Finally make a plot with as x variable the data vector and as y variable the density variable