Get startedGet started for free

Exercise 7. Distribution of IQ scores

The distribution of IQ scores is approximately normally distributed. The average is 100 and the standard deviation is 15. Suppose you want to know the distribution of the person with the highest IQ in your school district, where 10,000 people are born each year.

Generate 10,000 IQ scores 1,000 times using a Monte Carlo simulation. Make a histogram of the highest IQ scores.

This exercise is part of the course

HarvardX Data Science - Probability (PH125.3x)

View Course

Exercise instructions

  • Use the function rnorm to generate a random distribution of 10,000 values with a given average and standard deviation.
  • Use the function max to return the largest value from a supplied vector.
  • Repeat the previous steps a total of 1,000 times. Store the vector of the top 1,000 IQ scores as highestIQ.
  • Plot the histogram of values using the function hist.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# The variable `B` specifies the number of times we want the simulation to run.
B <- 1000

# Use the `set.seed` function to make sure your answer matches the expected result after random number generation.
set.seed(1)

# Create an object called `highestIQ` that contains the highest IQ score from each random distribution of 10,000 people.


# Make a histogram of the highest IQ scores.
Edit and Run Code