Distribution of IQ scores

#1
``````# 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.
highestIQ <- replicate(B, {
rd_10000 <- sample(rnorm(10000,15,100), B)
max(rd_10000)
})
# Make a histogram of the highest IQ scores.
hist(highestIQ)
``````

I am not able to calculate the highest IQ for a problem which is has an overview as below:
The distribution of IQ scores is approximately normally distributed. The expected value 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.

• 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.
• Plot the histogram of values using the function `hist` .

Distribution of scores