STAT 1080 - Fall 2026
  • Course Info
    • Overview
    • Syllabus
    • Support
    • Schedule
    • Useful links
  • Weekly Materials
    • W1. Introduction
    • W2. RStudio
    • W3. Correlation
    • W4. Programming
    • W5. Tidyverse
    • W6. Dates/Times and Distributions
    • W7. Data Visualization
    • W8. Statistics & Probability
    • W9. Data & Probability
    • W10. Random Variables
    • W11. Parameters & Estimates
    • W12. Statistical Inference
    • W13. Regression
    • W14. Regression
    • W15. Project Meetings

On this page

  • Warmup
  • Catching a con
  • Report an issue

10.3.L Lab: Random Variables

A man named 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 subpar materials, to scam the townsfolk.

You do some research on the weights of properly crafted brass instruments, and you learn the following facts:

  • Trombones weights are normally distributed, with a mean weight of 4.6 pounds and a standard deviation of 0.8 pounds. (Use rnorm, pnorm, dnorm, qnorm, with mean=4.6 and sd=0.8)

  • Trumpet weights are Uniformly distributed between 1.5 and 3.5 pounds. (Use runif, punif, dunif, qunif with min=1.5 and max=3.5)

  • Reed instruments (like clarinets, bassoons, and saxophones) have weights that are Chi-Square distributed with 4 degrees of freedom. (Use rchisq, pchisq, dchisq, qchisq with df=4)

Warmup

  • What is the 95th percentile for trumpet weight?
  • What is the 10th percentile for trombone weight?
  • About what percent of trombones do you expect to be more than 5 pounds?
  • About what percent of reed instruments do you expect to be more than 5 pounds?
  • Simulate 100 random trombone weights. How many of them were below 4 pounds?

Catching a con

You manage to intercept a shipping notice for 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!

First, write a function that samples the correct number of weights of trombones, cornets (trumpets), and reed instruments, and then returns the total weight.

Then, use that function to create 1000 random samples of total weight.

(Some code is provided for you below. Do not change the seed!)

music_man <- function(n_tromb, n_cor, n_reed){
  
  trombones <- rnorm(n_tromb, ...)
  cornets <- ...
  reeds <- ...
  
  total_weight <- sum(trombones) + sum(cornets) + sum(reeds)
  return(total_weight)
  
}

set.seed(1957)

my_weights <- replicate(1000, music_man(76, ...))
  1. How many of these samples had a weight less than Prof. Hill’s shipment?
  1. Create a histogram of the weights of your samples, and use geom_vline(xintercept=4532, color = "red") to add a vertical line to the histogram showing the weight of the shipment. Is the shipment’s weight unreasonable given your simulation?
  1. Based on this, do you believe Professor Hill is dealing in low-quality instruments, or not? Explain your answer.

© Copyright 2026, Susan Vanderplas

 
  • Report an issue