# Chapter 2Binary Random Process

A binary random process (BRP) is a sequence of experiments or events that each have one of two possible outcomes labeled $$A$$ and $$B$$. The closing price of SPY is one example of a BRP. Every day SPY can either close above the previous day or below (including staying the same). Another simple example of a BRP is the repeated flip of a coin where heads is recorded as $$A$$ and tails as $$B$$. There is no essential difference between SPY and the coin flip BRP other than the probabilities of the outcomes and how the probabilities change over time. We will therefore use the idea of coin flipping to illustrate some of the ideas behind the trading system.

To do any kind of analysis of a BRP you need to use what is called a binary random variable (BRV). A BRV assigns a numeric value to the two possible outcomes, $$A$$ and $$B$$. The numeric values can be anything but the type of analysis will usually indicate the best values to use.

Suppose for example that the BRP represents a coin flip betting game where you bet on one of the sides and then the coin is flipped. If the side you bet on comes up, you win $1, otherwise you lose$1. The natural numeric values to assign in this case are +1 for winning and -1 for losing.

The most important factor in the analysis of a BRP is the issue of probabilities. Since it is a random process, the outcomes are unpredictable and can only be assigned probabilities. In the simplest case the probabilities remain constant and if you know what they are then the analysis becomes almost trivial.

Assume for instance that the probability of $$A$$ is $$p$$ and that it remains constant throughout the process. The probabilities for all the possible outcomes of a random event must add to one, therefore the probability of $$B$$ must be $$1-p$$ and it also remains constant. When $$p>1/2$$ it means that $$A$$ will occur more than half the time and the optimal strategy is to always bet on it. Likewise if $$p<1/2$$ you should always bet on $$B$$. The expectation and variance of the associated BRV are easy to calculate in this case (see appendix A for an explanation of expectation and variance).

For example in the coin flip game $$A$$ has the value +1 and $$B$$ the value -1 so the expectation and variance are:

\begin{eqnarray}\label{eq10} E & = & p-(1-p) = 2p-1\\ \mathrm{Var} & = & 4p(1-p)\nonumber \end{eqnarray}

In particular if $$A$$ and $$B$$ have probabilities of 0.6 and 0.4 respectively, then you will win $$E=2p-1=0.2$$ or 20 cents on average per flip.

Unfortunately the actual probabilities for a BRP are almost never known and have to be inferred from a history of the process. Assuming the probabilities remain constant, it is a relatively simple procedure to estimate them. For a history of length $$n$$, count the number of times $$A$$ occurs and divide by $$n$$ to get an estimate for the probability.

$$\label{eq20} \tilde{p} = \frac{n_A}{n}$$

The mean square error (a way to measure the average error) for this estimate is:

$$\label{eq30} E[(\tilde{p}-p)^2] = \frac{p(1-p)}{n}$$

where $$p$$ is the real (unknown) probability. Since $$p$$ is unknown, the best you can do is to estimate the error by setting $$p=\tilde{p}$$. The estimate is:

$$\label{eq40} E[(\tilde{p}-p)^2] = \frac{n_A(n-n_A)}{n^2} = \frac{n_An_B}{n^2}$$

Obviously as $$n$$ increases the error in the estimate becomes smaller.

If you apply this to the stock market, where your analysis of the past history of a particular stock leads you to believe that the probability of $$A$$ is greater than that of $$B$$, then you should simply buy and hold on to the stock. If you believe that the probability of $$B$$ is greater than $$A$$ then sell short the stock and stay short. This may work well some of the time but the assumption of an unchanging probability can sometimes lead to disaster. There are better strategies which we will discuss in the next chapter.