Daily Speculations The Web Site of Victor Niederhoffer and Laurel Kenner
Write to us at:(address is not clickable)

16-May-2006
Recursive Functions, from Victor Niederhoffer

Whenever the market declines more than 30 S&P points in a week as it did in the week ended May 12, 2006, I like to read a few good books for perspective and enjoyment. As always, I turned first to my latest combinations textbook, Discrete Mathematics with Combinatorics. This one has excellent chapters on directed graphs and trees, number theory, probability, algebraic structures, recursions, generating functions, networks, computation, codes, enumeration of colors, ring and fields, and group characters among its 800 pages, and is a great source of new ways of looking at markets as well as a solvent for fuzzy thinking.

I have supplemented the chapter on combinations with study of the problem set "combinations some important results" because you can never practice combinatorics too much, as the number of scenarios that the market can throw at you is very limited, and the master problem generator, the market mistress, likes to economize by keeping the outcomes limited and fresh at the same time. I found the questions relating to permutation most inspiring this time because they're so close to what the market is asking all the time. Here's a typical one, "How many ways can five boys and six girls line up for a picture if two of the boys refuse to be lined up next to a girl?"  The general solution to such problems is the number of permutations of (n) different things taken (r) at a time when (p) particular things never occur is: n-p C r x r !

The particular situation that comes to mind in markets is: what is the expected number of ways the market will arrange three consecutive days relative to up and down, in a three-day period when it refuses to repeat any of the patterns that occurred in any of the last five days?

Inspiration from the minister. I was so inspired by the reading of these book that I asked the Minister of Non-Predictive Studies, Professor Pennington, to do some work on problems inspirited by counting. Here's his response:

The Chairman asked the Ministry for some simple example of permutations and combinations. Sometimes the Ministry must struggle to find something non-predictive, but that was not the case today.

We look at the 756 trading days of the S&P continuous futures ending 4/20/2006; actually we look at the 378 successive non-overlapping pairs of trading days.

A pair of trading days can either be down-down, down-up, up-down, or up-up. At first glance one would expect each possibility to happen 1 out of 4 times, but since the market moved upward, that makes the expectation that the probabilities involving "ups" will be higher. Therefore, we adjusted each trading day's return by subtracting off the drift over the period. The average trading day returned 0.46 points, and therefore that was subtracted from all.

Here are the numbers of occurrences of each combination:

```down-down  81 (21.4%)
down-up    103 (27.2%)
up-down    83  (21.9%
up-up     111  (29.3%)```

("down-up" means the first day was down and the second day up.)

From this table, you can infer that the number of "up" days was 2*111+83+103=408, 53.9%, and the number of down days was 348, or 46.0%.

So, somewhat surprisingly, the number of up days was greater than the number of down, even on the drift-corrected data. That means that the up days were frequent and made relatively small magnitude moves, while the down days were infrequent, but had larger magnitude moves.

Here's a bit of a puzzle--given that the first day was down, the probability that the next day would be up was 1.27 (=103/81) times the probability that it would down. Given that the first day was up, the probability that the next day would be up was 1.34 (=111/83) times the probability that it would be down.

Both those numbers (1.27 and 1.34) are greater than the ratio of total up days to down days, which is 408/348, or 1.17. Any ideas (Bueller?, Bueller?) about the apparent discrepancy?

Next we look at waiting times. How many pairs of days do we typically have to wait for a "down down" or an "up up".

Here's a table:

```average waiting time in day-pairs
down-down        4.68
down-up          3.65
up-down          4.52
up-up            3.42```

With a large enough sample, you'd expect all four numbers to be four. I  haven't done any analysis here of statistical significance. Does what we observe depart from randomness in a statistically significant way? Without doing any thinking, I'd say that it probably does, but that the anomaly stems from the excess number of "up" days that we had even after drift adjustment.

Altogether, we have a fine and appropriate product of the Ministry. 3, There is an excellent chapter in the Anderson book titled recursions revisited that solves linear and non linear recursive relations using various trigonometric identities. A good discussion of the Fibonacci recursive function is given using characteristic occasions to solve. Fib. functions are used often in books on technical analysis and regretfully I have never seen any evidence that is anything but mumbo and a marketing tool as it applies to markets, similar to the work on fractals of the descriptive bilious mathematician, B.M.

However it did inspire the following thoughts on a related recursive series and possibly this will lead to mutual education in the field.

We are accustomed to thinking of markets and measurements in natural philosophy in terms of the Fibonacci sequence:

```Fib(n) = Fib(n-1) + Fib(n-2).
The resulting series: 1, 1, 2, 3, 5, 8, 13... ```

Let me give equal prominence in market projections to the Catalan numbers:

```Cat(n+1) = Cat(n) * (2*(2n +1)/(n+2))
The resulting series: 1, 2, 5, 14, 42, 132, 429...```

Radoslav Jovanovic gives a nice discussion and a diagram of the uses of such numbers. I query, "Is there any reason to believe that markets move or levels achieve one set of numbers versus the others to an extent that is greater than random numbers might generate?" I'll give a prize for any reader who can differentiate between the utility of the two sets of numbers for markets and solicit your thoughts on the uses of these sets of numbers and others generated by similar recursive relations.

More writings by Victor Niederhoffer