Chart: Drunk and Her Dog
I was reading today an article about cointegration, written by Michael P. Murray. It describes a case of a random walking drunk accompanied by an unleashed dog. Occasionally the dog barks or the drunk calls the dog, and they try to get a little closer to each other based on the sounds.
I thought it may be interesting to visualize the process. You can see the result above :)
The drunk and her dog start at the position [0,0]. Their final positions (in this case after 100,000 moves by each) are indicated by the crossings of the green - for the drunk - and blue - for the dog - lines.
There are three parameters to set: the number of steps, the frequency of either dog barking or the drunk calling the dog, and the efficiency of the correction mechanism, i.e. how much they can reduce distance between themselves on each occasion they try to get closer, and how precisely they can set the course toward each other (the angel).
Although trajectories of both the drunk and the dog follow the random walk:
They are highly correlated:
And the distance between them is a stationary process:
You can decrease the correlation of the cointegrated processes by manipulating the frequency of error correction and precision of the correction mechanism - see parameters mentioned above.