Deming's funnel
Template:Draft Task American statistician and management guru W Edwards Deming used physical demonstrations to illuminate his management teachings.
In one such demonstration he dropped multiple marbles through a funnel at a target, marking where they landed, and observing the resulting pattern. A sequence of "rules" are tested to try to improve performance. In each case, the experiment begins with the funnel positioned directly over the target.
- Rule 1: The funnel remains directly above the target.
- Rule 2: Adjust the funnel position by shifting the target to compensate for the miss. If the last shot missed 1 cm east, move the funnel 1 cm to the west of its current position.
- Rule 3: As rule 2, but first move the funnel back over the target, before making the adjustment. E.g. If the funnel is 2 cm north, and the marble lands 3 cm north, move the funnel 3 cm south.
- Rule 4: The funnel moves directly over the last place a marble landed.
Task: Simulate 50 pseudorandom drops. The radial displacement of the drop from the funnel position is given by a Gaussian distribution (standard deviation is 1.0) and the angle of displacement is uniformly distributed. Apply each rule to the set of 50 drops, and show a scatter plot of the result.
Further explanation and interpretation. Video demonstration of the funnel experiment at the Mayo Clinic.
Racket
<lang racket>#lang racket (require math/distributions plot)
(define radii (map abs (sample (normal-dist 0 1) 100))) (define angles (sample (uniform-dist (- pi) pi) 100))
(define dxs (map (λ (r theta) (* r (cos theta))) radii angles)) (define dys (map (λ (r theta) (* r (sin theta))) radii angles))
(define (funnel dxs dys rule)
(let ([x 0] [y 0]) (for/list ([dx dxs] [dy dys]) (let ([rx (+ x dx)] [ry (+ y dy)]) (set! x (rule x dx)) (set! y (rule y dy)) (vector rx ry)))))
(define (experiment label rule)
(displayln label) (plot (points (funnel dxs dys rule)) #:x-min -15 #:x-max 15 #:y-min -15 #:y-max 15))
(experiment "Rule 1" (λ (z dz) 0)) (experiment "Rule 2" (λ (z dz) (- dz))) (experiment "Rule 3" (λ (z dz) (- (+ z dz)))) (experiment "Rule 4" (λ (z dz) (+ z dz)))</lang>