Jump to content

Deming's funnel: Difference between revisions

(→‎Further information: Don't normally have (sub)headings in the task description.)
Line 19:
* Further [http://blog.newsystemsthinking.com/w-edwards-deming-and-the-funnel-experiment/ explanation and interpretation]
* [https://www.youtube.com/watch?v=2VogtYRc9dA Video demonstration] of the funnel experiment at the Mayo Clinic.
 
=={{header|Python}}==
The funnel experiment is performed in one dimension. The other dimension would act similarly.
<lang python>from random import gauss
from math import sqrt
from pprint import pprint as pp
 
NMAX=50
 
def statscreator():
sum_ = sum2 = n = 0
def stats(x):
nonlocal sum_, sum2, n
 
sum_ += x
sum2 += x*x
n += 1.0
return sum_/n, sqrt(sum2/n - sum_*sum_/n/n)
return stats
 
def drop(target, sigma=1.0):
'Drop ball at target'
return gauss(target, sigma)
 
def deming(rule, nmax=NMAX):
''' Simulate Demings funnel in 1D. '''
stats = statscreator()
target = 0
for i in range(nmax):
value = drop(target)
mean, sdev = stats(value)
target = rule(target, value)
if i == nmax - 1:
return mean, sdev
 
def d1(target, value):
''' Keep Funnel over target. '''
 
return target
 
 
def d2(target, value):
''' The new target starts at the center, 0,0 then is adjusted to
be the previous target _minus_ the offset of the new drop from the
previous target. '''
return -value # - (target - (target - value)) = - value
 
def d3(target, value):
''' The new target starts at the center, 0,0 then is adjusted to
be the previous target _minus_ the offset of the new drop from the
center, 0.0. '''
return target - value
 
def d4(target, value):
''' (Dumb). The new target is where it last dropped. '''
return value
 
 
def printit(rule, trials=5):
print('\nDeming simulation. %i trials using rule %s:\n %s'
% (trials, rule.__name__.upper(), rule.__doc__))
for i in range(trials):
print(' Mean: %7.3f, Sdev: %7.3f' % deming(rule))
 
 
if __name__ == '__main__':
rcomments = [ (d1, 'Should have smallest deviations ~1.0, and be centered on 0.0'),
(d2, 'Should be centred on 0.0 with larger deviations than D1'),
(d3, 'Should be centred on 0.0 with larger deviations than D1'),
(d4, 'Center wanders all over the place, with deviations to match!'),
]
for rule, comment in rcomments:
printit(rule)
print(' %s\n' % comment)</lang>
 
{{out}}
<pre>Deming simulation. 5 trials using rule D1:
Keep Funnel over target.
Mean: -0.161, Sdev: 0.942
Mean: -0.092, Sdev: 0.924
Mean: -0.199, Sdev: 1.079
Mean: -0.256, Sdev: 0.820
Mean: -0.211, Sdev: 0.971
Should have smallest deviations ~1.0, and be centered on 0.0
 
 
Deming simulation. 5 trials using rule D2:
The new target starts at the center, 0,0 then is adjusted to
be the previous target _minus_ the offset of the new drop from the
previous target.
Mean: -0.067, Sdev: 4.930
Mean: 0.035, Sdev: 4.859
Mean: -0.080, Sdev: 2.575
Mean: 0.147, Sdev: 4.948
Mean: 0.050, Sdev: 4.149
Should be centred on 0.0 with larger deviations than D1
 
 
Deming simulation. 5 trials using rule D3:
The new target starts at the center, 0,0 then is adjusted to
be the previous target _minus_ the offset of the new drop from the
center, 0.0.
Mean: 0.006, Sdev: 1.425
Mean: -0.039, Sdev: 1.436
Mean: 0.030, Sdev: 1.305
Mean: 0.009, Sdev: 1.419
Mean: 0.001, Sdev: 1.479
Should be centred on 0.0 with larger deviations than D1
 
 
Deming simulation. 5 trials using rule D4:
(Dumb). The new target is where it last dropped.
Mean: 5.252, Sdev: 2.839
Mean: 1.403, Sdev: 3.073
Mean: -1.525, Sdev: 3.650
Mean: 3.844, Sdev: 2.715
Mean: -7.697, Sdev: 3.715
Center wanders all over the place, with deviations to match!</pre>
 
=={{header|Racket}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.