# ============================================================================== # STATYPUS ACADEMY SISTER SCRIPT: Simulations and the LLN # Chapter 6: Discrete Random Variable Simulations # ============================================================================== # --- TASK 1: Baseline Simulation (Syrup Pumps - Variable X) --- # Step 1: Declare the numeric values assigned by our random variable X pump_values <- c(0, 3, 4, 0) # Step 2: Establish the long-run probability weights for each drink outcome drink_weights <- c(0.40, 0.30, 0.20, 0.10) # Step 3: Run the predictive simulation machine (1,000 trials) simulated_shift <- sample(x = pump_values, size = 1000, replace = TRUE, prob = drink_weights) # Step 4: Evaluate the experimental mean of our long-run trial mean(simulated_shift) # --- TASK 2: Your Turn Adaptation (Espresso Shots - Variable Y) --- # [TWEAK HERE]: Copy lines 8-21 below this line. # Modify the values and sizes as directed on page 2 of your worksheet handout.