<- function(n_tromb, n_cor, n_reed){
music_man
<- rnorm(n_tromb, ...)
trombones <- ...
cornets <- ...
reeds
...
return()
}
PA 9: Instrument Con
Distributions + Simulation
Professor Harold Hill wanders into your small town. He claims to be selling top-quality instruments for a marching band. He begins selling his instruments to all the children in town.
You are suspicious of Professor Hill, and think that perhaps he is selling instruments made of sub-par materials to scam the townsfolk.
You do some research on the weights of properly crafted brass instruments, and you learn the following facts:
Trombone weights are normally distributed, with a mean weight of 4.6 lbs and a standard deviation of 0.8 lbs.
Trumpet weights are uniformly distributed between 1.5 and 3.5 lbs.
Reed instruments (like clarinets, bassoons, and saxophones) have weights that are Chi-square distributed with 4 degrees of freedom.
Warm-up
1. What is the 95th percentile for trumpet weight?
2. What is the 10th percentile for trombone weight?
3. About what percent of trombones do you expect to be more than 5 pounds?
4. About what percent of reed instruments do you expect to be more than 5 pounds?
5. Simulate 100 random trombone weights. How many of them were below 4 pounds?
Catching a Con
You manage to intercept a shipping notice for a delivery to Professor Hill. It says the following:
Wells Fargo Shipment 1957
To: Harold Hill, Mason City, Iowa
From: Music Factory, Gary, Indiana
Items included:
Trombones: 76
Cornets: 110
Saxophones: 542
Clarinets: 318
Bassoons: 175
Total Shipped Weight: 4532 lbs.
This is your chance to catch Professor Hill in his lie!
6. Write a function that samples the correct number of trombones, cornets (trumpets), and reed instruments (saxophones, clarinets, bassoons), and then returns the total weight of the shipment.
7. Use the function you just wrote to create random samples of the total weight of 1000 possible shipments. Do not change the seed in the code provided below!
set.seed(1957)
<- map_dbl(.x = 1:1000,
my_weights .f = ~ music_man(n_tromb = 76, ...)
)
Error in `map_dbl()`:
ℹ In index: 1.
Caused by error in `music_man()`:
! '...' used in an incorrect context
Canvas submission
You and your partner together should address the following questions:
How many of these samples had a weight less than or equal to Professor Hill’s shipment?
Do you beleive Professor Hill ordered genuine instruments?