).
CHAPTER
8
Trading Design
INTRODUCTIONIn the discussions so far, we have established that a key requirement forpairs trading is the existence of an equilibrium relationship between the logprice series of two stocks. We also discussed that the equilibrium relationshipis characterized by two quantities: the cointegration coefficient and the equilibrium value. Once they are known, they can be used to construct the linear combination of the log prices of the two stocks, which is referred to asthe spread. Pairs trading is a bet on the mean reversion property of thespread. When we make the determination that the spread has diverged sufficiently from the equilibrium value, we enter into an appropriate position inthe two stocks, betting that the divergence will correct itself, and the spreadwould revert back to equilibrium. It is therefore important for us to explicitly define what would qualify as a sufficient divergence of the spread valuefrom equilibrium for us to consider entering into a trade. The explicit specification of the divergence level enables us to boil down the actual trading ofthe spread to an unambiguous set of simple rules, which we will also referto as trading signals. Obviously, the proper design of trading signals has astrong bearing on the profit loss picture and is therefore an important topicfor discussion.Let us look at what we would need in order to design the trading rules.Well, if the dynamics of the spread are known, then we can design our trading signals in an appropriate fashion. So, what do we know about the dynamics of spreads? For one, we can expect all of them to be highly meanreverting, since that is the criterion we used to choose the pairs in the firstplace. Let us assume for the sake of argument that all spreads are stationaryARMA processes. ARMA processes are mean reverting in nature and therefore do not violate the basic requirement we set forth for a pair to be tradable. So, now it is clear that the spread can at a minimum be drawn from arich repertoire of ARMA processes and can therefore have dynamics that arewide and varied. We will discuss the different kinds of spread dynamics that118
Trading Design
119
we may encounter and the ramifications they hold in the process of designing trading signals.The driving principle in the design of trading rules is the maximizationof profits. The right choices could end up altering the profit picture dramatically. It is therefore important to have a robust approach to the design oftrading rules. Also, as noted earlier, the dynamics of the spread have a wideand varied repertoire. Under the circumstances, it would seem most appropriate if we had different design methods for different classes of spreads,each method tailored to its class, would it not? However, that need not bethe case. We propose here an approach to the design of trading rules whosemain feature is its one-size-fits-all quality. The methodology may be appliedto all spreads regardless of their dynamics, thus making the approach veryattractive.The game plan for the following material is to start with a simpleexample. We consider a white noise series and design trading rules for it.This will help to familiarize us with the underlying principles behind the design process. We follow this by discussing various classes of spread dynamics and the possible ways to model them. We then present our approach forthe determination of trading signals.
BAND DESIGN FOR WHITE NOISELet us discuss the design of trading signals when the spread in question canbe modeled as a white noise series. As noted earlier, the general principle involved in trading a spread is to put on a trade upon deviation from the equilibrium value and unwind the trade when equilibrium is restored. However,the actual implementation of the general principle could be wide and varied.On the one hand, we can adhere closely to the general principle put ona spread position on a deviation of ∆ from the equilibrium value and liquidate the position upon mean reversion. On the other hand, we could say thatthe spread swings equally in both directions about the equilibrium value andunwind the trade when it deviates by ∆ in the opposite direction. The argument for it would be that this reduces the trading frequency by a factor oftwo. Given that stocks have a bid-ask spread, we would incur a trading slippage every time a trade is executed. Reducing the trading frequency reducesthe effect of this slippage. The argument against it would be that this reducesthe trading frequency by a factor of two and increases the holding period inthe trade. This of course exposes us to mean drift, which was discussed inearlier chapters and may not be well suited to trade spreads with a lowerquality of signal-to-noise ratio.Another point to take into consideration in the trading process is theamount of inventory we are willing to hold on a spread. On one end of the
STATISTICAL ARBITRAGE PAIRS
120
spectrum, we could observe the spread at regular time intervals and put ona position whenever we spot a deviation, regardless of the current holdingsin inventory relying on the statistics of the spread series to control our inventory. On the other extreme, we could limit our exposure to one spreadunit;1 that is, if we currently have one unit of spread in inventory, then evenif we observe a deviation in the same direction, we do not add on to our position. However, if the spread deviates in the opposite direction, we close outour current position and enter into a new spread position in the opposite direction of our original holdings. Practical trading is probably somewhere between the two extremes.Given the different trading styles, it would be natural to require thattrading rule design be tailored to the specifics of each trading style. Fortunately for us, though, the specifics of the trading style do not matter in thedetermination of ∆ to maximize profits. To see that more clearly, let us nowwalk through the process of determining the value of ∆ when the spread is aGaussian white noise series.The Gaussian white noise series is a series of drawings from a Gaussiandistribution. We buy one unit of the spread whenever we observe that thespread has a value less than or equal to –∆. Similarly, we sell one unit of thespread when we observe a value greater than or equal to ∆. The probabilitythat a white noise process at any time instant deviates by an amount greaterthan or equal to ∆ (∆ being positive) is determined by the integral of theGaussian process, which is 1–N(∆). Therefore, in T time steps we can expectto have T 1 − N(∆) instances greater than ∆. Similarly, the probability ofthe value being less than or equal to –∆ is given by N(–∆). Now, owing to thesymmetry of the Gaussian process N(–∆) = 1 – N(∆) and therefore the number of instances, we expect the value of the spread to be less than or equalto –∆ is also T(1–N(∆). Thus, in a time span of T units we can expect to havebought and sold the spread on an average of T 1 − N(∆) times. The profiton each buy and sell is 2∆. A measure of profitability for trading in thetime period T is therefore (profit per trade × number of trades); that is,2T∆ 1 − N(∆) .2 Also, note that even if we were to liquidate our positions atequilibrium value, the measure of profitability would remain the same.Now the problem of band design boils down to determining the value of∆ that maximizes ∆ 1 − N(∆) . Figures 8.1a and b are plots of such a function. On the x-axis is the value of ∆ as measured in terms of the standard deviation of the normal density about the mean. The y-axis is a plot of the
(
)
(
(
)
)
(
)
1A unit of spread is determined by the average volume per trade in the two stocks andthe ratio between them.2Note that this is not the actual percentage profit as measured in conventional terms.If we do assume that we have relatively deep pockets and wish to maximize the dollar yield, then the measure as described here is appropriate.
Profit Value
Trading Design
121
0.1
0.00.0
0.2
0.4
FIGURE 8.1A
0.60.81.01.21.4Amount of Sigma Away from Mean
1.6
1.8
2.0
1.8
2.0
White Noise Threshold Design.
Profit Value
90060030000.0
FIGURE 8.1B
0.2
0.4
0.60.81.01.21.4Amount of Sigma Away from Mean
1.6
Threshold Simulation with Unit Inventory Constraint.
function value. Note that the maximum occurs at 0.75s. This would be thevalue that maximizes the profit.Let us now consider the case where we restrict the inventory held at anytime to one spread unit. The spread unit for our purposes is a fixed quantityof shares for the two stocks in the appropriate ratio as defined by the cointegration coefficient. Naturally, this quantity is dictated by the average tradevolume of the two stocks comprising the pair.When the spread value is more than delta and we are long one unit ofspread, we sell two spread units: one to unwind the long spread position andanother to have short position on the spread. The results of the analysis asalready described still hold in this case. To check that this is true, we ran asimulation using 5,000 white noise realizations and calculated the profits for
122
STATISTICAL ARBITRAGE PAIRS
different values of ∆, assuming that we trade exactly in the manner described. The plot of the profit against different values of ∆ is shown is Figure 8.1b. Note that it is identical to the curve in Figure 8.1a. We cantherefore safely conclude that the inventory constraints do not matter in theprocess of deciding the value of ∆.Now that we understand the principles underlying the design process,it would be a good time to discuss its limitations as well. Note that there isan implicit assumption that the stocks would be uniformly liquid at all levels of divergence of the spread from equilibrium. This, of course, is farfrom reality. It may be that due to liquidity issues the value of delta atwhich the spread may be put on in size could be lesser than the one suggested by this approach. That would then be the true delta at which theprofits are maximized.This leads us to our next peeve about this approach. It says nothing atall about position size. It seems as though we could keep adding on to a pairsposition and make unlimited profit when the spread converges. Needless tosay, it would be naive to believe that would be the case. To see why, considerthe following. By engaging in pairs trading, we are contributing to the market forces that cause the convergence of the spread. We need to make sure
Trading Design
123
that at no point in time the spread position size gets to a point where we become the dominant force contributing to the convergence. If that happens,then it becomes difficult to unwind the position without a substantial slippage. Any gains we make in the spread will be lost in the slippage. It is therefore important to recognize that there is a physical limit to which we couldincrease the size of the pairs position, even though the design process saysnothing in that regard.So, what do we make of the design process when it does not handlethese issues? A good way to look at the results of the design process is thatin the absence of any information whatsoever and having to deal with making decisions in a vacuum, the results of design process serve as a strongguideline to aid in the process of designing trading rules. We now move onto some reflections on spread dynamics.
SPREAD DYNAMICSThe purpose of this section is to demonstrate that the modeling of the spreadin parametric terms could indeed get complex. To get an idea of the plausible range of models for spread dynamics, we will engage in a series of whatwe shall call “Thought Experiments.”3 We will look at some empirical observations and the implications they bear for us when attempting to modelspread dynamics. We will start with the simplest case of Gaussian whitenoise and reason our way toward more complicated models.
Case 1: Mixture Gaussian ModelWe can expect a white noise time series for the spread to occur when trading security pairs that have a strict parity relationship. An example of this isindex arbitrage, which involves trading the S&P futures against the index.But is it reasonable to expect the white noise to be strictly Gaussian? Gaussian white noise would mean the value of the spread at any point in time isdrawn from a fixed Gaussian distribution. But the trading of securities ismore brisk around the open and close. This causes increased volatilityaround these times. Hence, it would not be too much of a stretch to expectthe spread series to also exhibit higher volatility around these times. We cantherefore extend the white noise model by asserting that the white noisespread values are drawn from Gaussian distributions with higher standarddeviations around the market open and close and a relatively low standarddeviation around midday.3A fine term coined by theoretical physicists in an era where the average physicist wasexpected to toil at the laboratory conducting real experiments.
124
STATISTICAL ARBITRAGE PAIRS
In addition to that, let us now bring into consideration the empirical observation of GARCH effects in the volatility of individual stock returns.GARCH is an acronym for generalized auto-regressive conditional heteroskedascity. There is a huge body of literature on it and its ramificationsfor options pricing. To describe the phenomenon from a modeling perspective, let us consider a time series whose value at any point is drawn from aGaussian distribution. If the distribution is fixed, we would have Gaussianwhite noise. However, we could allow for the variance of the distributionused at each point in time to vary. In fact, we go even further and prescribethat the variance of the distribution must follow an ARMA time series. If wedo that, we now have a GARCH process. Although GARCH processes havebeen observed and recorded for individual stocks return series and not forspreads, we assert that it is definitely within the realm of plausibility thatwhite noise spreads could exhibit the GARCH property.In any case, to summarize the discussions so far, it seems as though itwould be more realistic to model white noise spreads as values drawn fromnormal distributions but with standard deviations that are dependent ontime. The overall distribution of the spread values in this case may be referred to as a mixture Gaussian distribution.So, how do we design the trading rules in this case? The solution maybe to resort to multiple threshold levels instead of one to maximize participation in the markets at times of both high and low volatility. We wouldthen need to estimate the component Gaussian distributions and design thelevels for each one of them. An alternate approach would be to do a dynamic estimation of the volatility using say Kalman filtering methods andlet the levels vary with time.
Case 2: ARMA ModelNow let us consider the case of a stock that has just experienced a newsevent. We can expect the stock to trade in increased volumes with higherprices leading to higher prices or lower prices leading to lower prices, depending on the nature of the news event. In other words, we could expectstock prices to exhibit a momentum-like behavior. If this stock were to bepaired up with another stock for pairs trading and the news event was specific to the particular stock, it would definitely not surprise us to see the momentum in the stock price series manifest itself as momentum in the spreadseries. In other words, we expect to see some correlation between consecutive values of the spread leading to a meaningful autocorrelation functionand therefore an ARMA series for the spread.So, how do we design our trading rules in this case? The underlyingprinciples remain the same. Any choice for the threshold level has a profitper trade associated with it. If we know the rate at which the threshold levelis crossed, we can determine the expected number of trades. The total ex-
Trading Design
125
pected profit is then easily calculated by multiplying the number of tradeswith the profit per trade. This calculation can be done for different threshold values, and the value that yields the maximum profit is chosen as thethreshold.The preceding approach necessitates that we know somehow the rate ofcrossing of a particular level for an ARMA series. Luckily for us, the probability or rate of zero crossing or level crossing for an ARMA process maybe calculated using Rice’s formula. Armed with this information, we cannow say that we are ready to handle spreads modeled as ARMA processes.
Case 3: Hidden Markov ARMA ModelsRecall that the ARMA series is a linear combination of past white noise realizations. Traditionally, the white noise series used in the construction ofARMA series are assumed to be Gaussian. But from our earlier discussioninvolving securities that enjoy a strict parity relationship, we expected thespread to be a mixture Gaussian white noise. It is therefore not much of astretch to speculate that the underlying white noise series in the ARMA caseto also be a mixture Gaussian white noise series and exhibit GARCH-likeproperties.The most generalized model to cover these cases could be to say that theunderlying white noise series is generated by drawing a sample from aGaussian distribution. The Gaussian distribution is at a given time instant,however, chosen by rolling the dice. Better still, we say that the exact distribution to use is decided by a Markov process. A Markov process is a processwhere the set of outcomes of the dice rolling is dependent on the current distribution. After the distribution is decided, we then use it to draw the whitenoise realization. Note that the white noise generation in this case is a twostep process. The first step decides the distribution to sample from, and thesecond step actually draws a sample from the distribution. Models of thiskind have been used in speech processing and are termed hidden Markovmodels. The parameters of such models may be evaluated using the popularBaum-Welch algorithm.Our model construction process is not done as yet. Once the white noiseprocess is generated using the mechanism just described, we construct anARMA process by taking linear combinations of the past white noise realizations at each time step. (Whew!) Note that the modeling process describedin this section is actually a synthesis of the models described in the two earlier sections.So, how do we decide the threshold values in this case? As a matter offact, at this level of complication there are no known methods as of now toevaluate the zero-crossing or level-crossing rates other than by way of simulation. One could extract the model parameters from the existing sampleand generate time series data using these parameters. The profit potential of
126
STATISTICAL ARBITRAGE PAIRS
a threshold value is then estimated by simulating trades on the generateddata. The profits thus calculated could then be used to determine the optimal value for the threshold.
CommentaryReflecting on the deliberations so far, it appears that the closer we wish tomodel the spread to reality, the more complicated the models get. The computational methods used in these situations in turn get increasingly involved.It seems that it would be quite a formidable challenge to simplify the approach, does it not? Then again, it may be that we are not looking at theproblem with the right perspective. Let us therefore restate what we wish toaccomplish.The purpose of the whole exercise is to come up with a reasonable andreliable approach to decide the threshold values. So far, the assumption hasbeen that in order to design the threshold values it is necessary to know thedynamics of spread behavior intimately and have parametric models (models where knowledge of a few parameters gives us a complete description ofthe dynamics) describing their behavior. That, however, need not be thecase. We would remain happy campers if we could come up with a reasonable band design without having to worry about modeling the dynamics ofthe spread using parametric models. So, for our purposes we resort to nonparametric methods where we estimate the profit profile function directlyfrom the sample realization of the spread; that is, the spread series observedin the recent past. Obviously, it does not require much persuasion to subscribe to the argument that we get more of the proverbial bang for the buckon adopting the nonparametric approach.As mentioned earlier, the idea in the nonparametric approach is to estimate the profit function directly from the sample realization of the spread.This would preclude us from having to use relatively involved computational schemes to estimate the parameters of the model had we gone theparametric route. But we have only one sample realization, and so relyingcompletely on this realization would bias our results too much to this realization. We address this issue of bias and describe a reasonable method forthreshold design in the following section, nonparametric approach.
NONPARAMETRIC APPROACHOne of the key issues that relate to estimating the profit function directly isthe size of the spread sample. The larger the size of the sample the more confident we can be that the sample truly represents all aspects of the behaviorof the spread. The statement above has in it a built-in assumption of ergod-
Trading Design
127
icity. Ergodicity has a rigorous mathematical definition and proof, but forour purposes, it may be simply stated as follows: A large sample size is effectively equivalent to having multiple realizations of the series of smallersample sizes. Therefore, with large sample sizes for the spread, we can bereasonably confident that the effects of bias to the sample at hand have beenmitigated.However, a large sample size may be a luxury that we are not afforded.Recall that the spread dynamics are directly linked to the fundamentals ofthe firm and its valuation. These fundamentals are dynamic and continue toevolve with time. Therefore, the observations of the spread far back in thepast may or may not be of significance, depending on whether the fundamentals of the firms involved remained more or less the same. It is thereforelikely that we may find ourselves in a situation where we need to estimatethe profit function from a relatively small sample data set.We will soon describe the steps to overcome this issue and propose anapproach to evaluate a close approximation to the profit function. To convince the skeptical reader that this approach actually produces reasonableresults, we will apply the approach to the white noise case. We alreadyknow the true functional form of the profit in the white noise case andtherefore the true optimal value for the threshold. The threshold value estimated using this approach can now be compared with the true value, thusproviding us with a validation of the nonparametric approach suggested.
THE PROOF OF THE PUDDINGIn the Mark Twain classic A Connecticut Yankee in King Arthur’sCourt, Merlin, the wizard in Arthur’s court claims to have the abilityto foresee things and know the unknown. The Yankee, pragmatic as heis, challenges Merlin to guess what he (the Yankee) is holding in hishand. As the Yankee knows what he is holding in his hand, this wouldserve as a ready test case to verify Merlin’s claim.In fact, the idea of the proof of the pudding is in the eating isstandard fare in the area of signal processing to demonstrate the efficacy of an estimation algorithm. A sample data set for which the parameters are known is submitted to the estimation algorithm. Theperformance of the estimation algorithm is measured by how closelythe algorithm guesses the known true value of the desired parameters.In this case, we apply the approach to the white noise case. The valueobtained from the estimation can be compared with the true value toprovide us some evidence of the efficacy of the approach.
128
STATISTICAL ARBITRAGE PAIRS
We now begin the description of our approach. Note that we couldchoose a threshold level anywhere in the continuous range from zero to anylarge positive number. As a first order of business, we reduce the continuumof choices to a finite set of discrete choices for the threshold level. This is because from a trading perspective, discretization of the levels makes a lot ofsense. To convince ourselves of that, let us consider the situation where wecalculate the observed spread using the last traded price in both the securities. Even though the spread is calculated that way, we can typically expectto buy a security on the bid price and sell the other on the offered price. Theimplication is that we may have to be willing to give up the bid-ask spreadin both the stocks when putting on the spread. This is called slippage in theprocess of trading. Now let us consider two candidate threshold levels thatare spaced very close to each other. Note that if the spacing between them isless than slippage costs, then as far as trading goes, the two levels are virtually indistinguishable. Therefore, it does make sense to have the candidatethreshold levels apart by at least the estimated slippage on trading.Having established the candidate threshold levels that extend symmetrically above and below the mean value of the spread series, we are nowready to start the process. We begin with a simple count of the number oftimes the spread exceeds a particular threshold. When the threshold is abovethe mean, this is the number of times the spread is greater than the threshold. Similarly, when the threshold is below mean, it is the number of timesit is the number of times the spread value is below the threshold. This counting method mimics the trading style where we put on a spread positionwhenever we observe that the threshold has been exceeded and liquidate theposition when we hit the mean value. If we go with the assumption that thespread moves are symmetric about its long run mean value, we can marginally improve the estimate and reduce the bias by averaging the frequencycount for the positive and negative values for the same absolute value for thethreshold.This count for each threshold level can then be multiplied by the profitvalue corresponding to the threshold level to obtain the raw profit function.Given that this data is from a small sample set, we can expect this to benoisy. Figure 8.2a is the plot of the probability estimates from a simplecount of the number of level crossings. The underlying spread series is awhite noise sample with 75 data points. Figure 8.2b is the plot of the profitmade for trading the spread at a particular threshold, which is equal to thethreshold value itself. Figure 8.2b is therefore a straight line with slope 1.The raw profit profile is a product of the two values for a given threshold.Figure 8.3 is a plot of the raw profit profile for the white noise samplewith 75 data points, as shown. One can see how noisy and jagged the curveis. If the raw curve were to be used as is, it could be rather confusing to arriveat any meaningful conclusion on where exactly the thresholds must be placed.
Trading Design
129
Probability
0.50.40.30.20.10.00.0
0.2
0.4
FIGURE 8.2A
0.6
0.81.01.21.4Sigma Away from Mean
1.6
1.8
2.0
1.8
2.0
Probability Estimates from Counts.
2.0
Profit
1.51.00.50.00.0
0.2
0.4
0.6
0.81.01.21.4Sigma Away from Mean
FIGURE 8.2B
1.6
Profits Levels.
Let us now attempt to explain the reason why we obtain such a noisy estimate for the profit profile. Note that we have a fine level of discretizationthat is coupled with a small sample size. This has led to a step function formfor the count function, which in reality is expected to be monotonically decreasing. Also, notice that whenever we hit a step, the profit profile kinksupward. We shall term this the discretization effect. To obtain a frequencycount that is monotonically decreasing, we would need to correct for thisdiscretization effect. We can correct for the discretization effect and ensurea monotonically decreasing function by performing a simple linear interpolation between the points constituting the two levels in the step function. Toshow what we mean, look at Figure 8.4.After this adjustment, even though the count is monotonically decreasing, it is still not smooth. The solution we propose to overcome this is widely
STATISTICAL ARBITRAGE PAIRS
130
0.20
Profit Profile
0.15
0.10
0.05
0.000.00
FIGURE 8.3
0.2
0.4
0.60.81.01.21.4Amount of Sigma Away from Mean
1.6
1.8
2.0
Profitability of Thresholds: No Inventory Constraints.
known as regularization. The following section contains an in-depth description of the regularization process. Upon completion of the regularization process, the resulting count function may be used to calculate theprofit profile and the maximum value read off as the optimal thresholdvalue to use.
REGULARIZATIONLet us restate the problem for sake of clarity. We are attempting to estimatethe frequency function for level crossing given a sample realization. Suchproblems involving the estimation of functions given data fall under thegeneral subject area of inverse problem theory. Regularization is one of themost basic ideas of this theory. The fundamental idea in regularization isthat of two cost measures. The first cost measure quantifies the degree ofagreement of the computed function to the given data. The second costmeasure quantifies the deviation from a known property of the function like
Trading Design
131
0.5
Raw CountsMonotonic Adjustment
0.4
0.3
0.2
0.1
0.00.00 0.15 0.30 0.45 0.60 0.75 0.90 1.05 1.20 1.35 1.50 1.65 1.80 1.92 2.10Amount of Sigma Away from Mean
FIGURE 8.4
Raw Counts Adjusted for Monotonicity.
smoothness. In the process of evaluating the function given data, it is verylikely that the two cost measures are somewhat at odds with each other. Ifwe decide to fit the functional form very closely to the data, then we mayhave to give some slack on the degree of smoothness of the data. However,if we adhere strongly to the notion that the function is smooth, we may haveto sacrifice on the agreement of the function to the data. The choice of thefunction therefore involves a delicate balancing act between the two costmeasures. Note that the previously mentioned idea can also be couched interms of the classic and ubiquitous notion in statistics of the compromise between goodness of fit and bias. If the reader is thinking that the idea has afamiliar ring to it, it is probably because we visited this notion before inChapter 2 (and you can be sure that you will read of this again in the book).Depending on the nature of the second cost measure that relates to theproperty of the function being estimated, regularization is referred to by
STATISTICAL ARBITRAGE PAIRS
132
many different names. Methods that use a log-like function for the costmeasure are popularly called maximum entropy methods, or MEM methodsfor short. If the cost measure is the sum of the squared difference betweenadjacent points in the estimated function, then it is called Tikhonov-Millerregularization.So, the question now turns to what kind of regularization we should usein our case; that is, what property of the function should we try to capturein the regularizing cost measure? In addition to being monotonically decreasing, the other property that we can expect from the function is that itis smooth. We could therefore use the Tikhonov-Miller regularization to ensure smoothness of the resulting estimate. We now describe the TikhonovMiller process.We are given data points x1 , y1 , x2 , y2 , x3 , y3 , … , xn , yn . The xiseries in the data set refer to the threshold values, and the yi series are thecounts corresponding to them. If this data set is representative of the actualfunction, then we should use the values of y as is in the final function. However, the data are from a single sample set and therefore contain the peculiarities unique to this sample, leading to a step function form for the counts.We expect the curve to be a smooth monotonic decreasing function. Asmentioned earlier, we introduce a penalty term for the roughness of thecurve. This penalty term is the sum of squared differences between adjacentpoints of the estimated function. The cost function to minimize is now aweighted sum of the two cost measures as shown next.Let z1, z2, z3, . . . , zn represent the estimated function for the pointsx1,x2,x3, . . . ,xn correspondingly. The cost function with the two terms is then
(
(
)(
)(
)
(
) + (y − z ) + … + (y − z ) +λ ( z − z ) + ( z − z ) + … + ( z− z ) 
cost = y1 − z1
2
2
2
2
2
2
n
2
1
n
2
2
3
)
2
n −1
(8.1)
n
It is easy to recognize that the first part is a least-squared cost measure, andthe second part is the penalty for roughness of the curve. Note that this costmeasure is multiplied by a term l. This is the trade-off factor, and it a measure of how much of a fit error we are willing to allow for reducing thesmoothness cost by one unit. The problem of Tikhonov-Miller regularization is to minimize this function with an appropriate value of l. Note thatthe choice of l is crucial, as it determines the trade-off between smoothnessand fit error and, in turn, the final shape of the function. So, how do we determine the correct value for l and the resulting regularized function? Wewill describe the process by way of example.Let us consider a simulated white noise sample that we generated. Wedesign the threshold values and do a basic count of the number of times the
Trading Design
133
spread exceeds the thresholds. The count is this example is represented as afraction, which is obtained by dividing it by the total number of samplepoints. Then we construct the cost function corresponding to these counts.Strictly speaking, a constrained minimization would need to be performedon the cost function by anchoring the count fraction at zero to be at thevalue 0.5. This is to recognize the assumption of symmetry