W Edwards Deming was an American statistician and management guru who used physical demonstrations to illuminate his teachings. In one demonstration Deming repeatedly dropped marbles through a funnel at a target, marking where they landed, and observing the resulting pattern. He applied a sequence of "rules" 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 after each drop. E.g. If the last drop 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 of the target.
 Rule 4: The funnel is moved directly over the last place a marble landed.
Apply the four rules to the set of 50 pseudorandom displacements provided (e.g in the Racket solution) for the dxs and dys. Output: calculate the mean and standard-deviations of the resulting x and y values for each rule.

Note that rules 2, 3, and 4 give successively worse results. Trying to deterministically compensate for a random process is counter-productive, but -- according to Deming -- quite a popular pastime: see the Further Information, below for examples.

Stretch goal 1: Generate fresh pseudorandom data. 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.

Stretch goal 2: Show scatter plots of all four results.



Further information

 Further explanation and interpretation
 Video demonstration of the funnel experiment at the Mayo Clinic.
 
dx=:".0 :0-.LF
 _0.533 0.270 0.859 _0.043 _0.205 _0.127 _0.071 0.275
 1.251 _0.231 _0.401 0.269 0.491 0.951 1.150 0.001
 _0.382 0.161 0.915 2.080 _2.337 0.034 _0.126 0.014
 0.709 0.129 _1.093 _0.483 _1.193 0.020 _0.051 0.047
 _0.095 0.695 0.340 _0.182 0.287 0.213 _0.423 _0.021
 _0.134 1.798 0.021 _1.099 _0.361 1.636 _1.134 1.315
 0.201 0.034 0.097 _0.170 0.054 _0.553 _0.024 _0.181
 _0.700 _0.361 _0.789 0.279 _0.174 _0.009 _0.323 _0.658
 0.348 _0.528 0.881 0.021 _0.853 0.157 0.648 1.774
 _1.043 0.051 0.021 0.247 _0.310 0.171 0.000 0.106
 0.024 _0.386 0.962 0.765 _0.125 _0.289 0.521 0.017
 0.281 _0.749 _0.149 _2.436 _0.909 0.394 _0.113 _0.598
 0.443 _0.521 _0.799 0.087
)
 
dy=:".0 :0-.LF
 0.136 0.717 0.459 _0.225 1.392 0.385 0.121 _0.395
 0.490 _0.682 _0.065 0.242 _0.288 0.658 0.459 0.000
 0.426 0.205 _0.765 _2.188 _0.742 _0.010 0.089 0.208
 0.585 0.633 _0.444 _0.351 _1.087 0.199 0.701 0.096
 _0.025 _0.868 1.051 0.157 0.216 0.162 0.249 _0.007
 0.009 0.508 _0.790 0.723 0.881 _0.508 0.393 _0.226
 0.710 0.038 _0.217 0.831 0.480 0.407 0.447 _0.295
 1.126 0.380 0.549 _0.445 _0.046 0.428 _0.074 0.217
 _0.822 0.491 1.347 _0.141 1.230 _0.044 0.079 0.219
 0.698 0.275 0.056 0.031 0.421 0.064 0.721 0.104
 _0.729 0.650 _1.103 0.154 _1.720 0.051 _0.385 0.477
 1.537 _0.901 0.939 _0.411 0.341 _0.411 0.106 0.224
 _0.947 _1.424 _0.542 _1.032
)
 
Rule1=: ]
Rule2=: -/\.&.|.
Rule3=: ]-0,}:
Rule4=: ]+0,}:
 
smoutput '  Rule 1 (x,y):'
smoutput '  Mean: ',":dx ,&mean&Rule1 dy
smoutput '  Std dev: ',":dx ,&stddev&Rule1 dy
smoutput '  '
smoutput '  Rule 2 (x,y):'
smoutput '  Mean: ',":dx ,&mean&Rule2 dy
smoutput '  Std dev: ',":dx ,&stddev&Rule2 dy
smoutput '  '
smoutput '  Rule 3 (x,y):'
smoutput '  Mean: ',":dx ,&mean&Rule3 dy
smoutput '  Std dev: ',":dx ,&stddev&Rule3 dy
smoutput '  '
smoutput '  Rule 4 (x,y):'
smoutput '  Mean: ',":dx ,&mean&Rule4 dy
smoutput '  Std dev: ',":dx ,&stddev&Rule4 dy