← STAT 20070

Section 3 · Lecture 14 · Inference Visualisation

Inference Visualisation

A bus comes every 10 minutes and you arrive at a random moment, so your wait is anywhere from 0 to 10 minutes, all equally likely. Average a few waits and the averages pile up into a bell curve. From there the lab builds up to inference: standardising, z versus t, a first look at testing and confidence intervals. It follows the in-class R script, inference_visualization, section by section, with nothing to install.

μ = 5 minμ= (a + b)/2= (0 + 10)/2
σ = 2.887 minσ= √((b − a)²/12)= 10/√12
R script §1 · Single waiting time

One waiting time

Your wait Y is equally likely to be anything between 0 and 10 minutes: Y ~ Uniform(0, 10). Each draw is one simulated trip to the bus stop: the computer picks a random arrival time within the 10 minutes between buses and records how long you wait, which is what runif(1, 0, 10) does in R. Draw waits one at a time, then thousands, and watch the histogram flatten out. This flat shape is the population we will average from.

x_new <- runif(1, 0, 10) draws_n1 <- c(draws_n1, x_new)

What is a draw?

A draw is one random waiting time. Imagine arriving at the stop at a random moment: the time until the next bus is your wait. The computer imitates this by picking a number between 0 and 10 at random, with every value equally likely. In R this is runif(1, 0, 10).

“Draw 1 wait” does this once and adds one line to the strip. “Draw 10” does it ten times, giving ten separate waits.

Each line is one waiting time

Histogram of all the waits

your draws (density)Uniform(0, 10) density = 1/10