fun with feedback frequency

I'm currently reading Brain of the Firm, by Stafford Beer. On page 36 he writes:

The outcome is startling ... ... the total system is dominated, not by the forward network, but by the feedback network ... The output signals will be of greater 'purity' than we had any right to expect.

The word feedback caught my eye.
Feedback is a key principle of complex adaptive systems.
Feedback is also one of the 4 values of eXtreme Programming.
Feedback also gets several mentions in the official Scrum Guide.
So I've been playing around with Feller's walk (named after William Feller) some more...

Feller's Walk

Each Feller's walk is 1000 steps long, and at each step I flip a fair coin.
As I walk I keep a running total (starting at zero):
  • adding one each time I flip a head
  • subtracting one each time I flip a tail
What will the total look like as the walk progresses?
Here's the plot of the step (x-axis) against the total (y-axis) during one simulated walk.


It starts at a total of zero on the far left and wanders along, edging upwards when a head is thrown, edging downwards when a tail is thrown, and ending at about -26 indicating that overall there were 487 heads and 513 tails (487-513=-26, 487+513==1000).

Apparently, most people's intuition is that the total will hover around zero.
But it doesn't.
You cannot rely on randomness to correct the problems that randomness creates.
Without constraints variance will accumulate.
If the total happens to be +24 the coin isn't going to throw more tails for a while to try to balance things up.
Without feedback the coin has no memory.

To help see this I simulated 5000 walks and plotted the frequency of the total (y-axis) against the total (x-axis) at various points along the walks:
  • after 10 steps in gold
  • after 100 steps in blue
  • after 1000 steps in red
  • I chop the x-axis to +- 2 standard deviations

step freq[0] max
abs(total)
std.dev
10 1204 -10 3.19
100 405 36 10.15
1000 121 140 31.71

Over all the walks, at the 10th step:
  • the total was zero 1204 times (5 heads, 5 tails, 5-5=0, 5+5=10)
  • the total farthest from zero was -10 (0 heads, 10 tails, 0-10=-10, 0+10=10)
  • the standard deviation of the total was 3.19
Over all the walks, at the 100th step:
  • the total was zero 405 times (50 heads, 50 tails, 50-50=0, 50+50=100)
  • the total farthest from zero was 36 (68 heads, 32 tails, 68-32=36, 68+32=100)
  • the standard deviation of the total was 10.15
Over all the walks, at the 1000th step:
  • the total was zero 121 times (500 heads, 500 tails, 500-500=0, 500+500=1000)
  • the total farthest from zero was 140 (570 heads, 430 tails, 570-430=140, 570+430=1000)
  • the standard deviation of the total was 31.71
The further along the walk I progress, the less likely my total is to be zero.
Without constraints variance will accumulate.

Once again, with feedback

Every Nth step, instead of flipping the coin, I look at the total and:
  • if the total is negative (more tails than heads) I pretend I've flipped a head, and add one to the total.
  • if the total is positive (more heads than tails) I pretend I've flipped a tail, and subtract one from the total.
This feedback increases the likelihood of the total staying nearer to zero.
The smaller the value of N, the greater the effect.

Estimating feedback effectiveness

Using the simulation I can measure how good (or bad) people's estimates are of how effective feedback is. For example, I can:
  • run the simulation with some feedback (N==10 say) and display the results
  • gather estimates with no feedback (N==never) of, eg
    • freq[0], or
    • max abs(total), or
    • std.dev, etc
  • run the simulation with no feedback and see how the actual results compare.
Or
  • run the simulation with no feedback and display the results
  • gather estimates of the least feedback needed to, eg
    • triple freq[0], or
    • quadruple max abs(total), or
    • half std.dev, etc
  • run the simulation with various amounts of feedback and see how the actual results compare.
I've put the simulation source up on https://github.com/JonJagger/Fellers-1000-coin-tosses.
The simulation runs directly from this URL https://rawgithub.com/JonJagger/Fellers-1000-coin-tosses/master/fellers.html so you can try out various values of N if you want to before reading on...

A little feedback goes a long way

Here's 5000 simulations of a 1000 step walk with N==25.
That means, that every 25th step instead of flipping the coin, the simulation nudges the total towards zero as described above.


step freq[0] max
abs(total)
std.dev
10 1379 -10 2.97
100 553 32 8.04
1000 387 84 15.18

The effectiveness of one feedback nudge every 25 steps amazes me.
  • freq[0] tripled from 121 to 387
  • max abs(total) shrank from 140 to 84
  • std.dev halved from 31.71 to 15.18
Startling! Just as Stafford Beer said.
Let's hear it for feedback!