• No results found

4.2.1

Parallel computing in Mathematica

The recursive framework in dynamic programming is highly amenable to parallel computation. This is because the determination of value function at a point in state spaceS at timek only need only know the value function in state space one time step ahead3. The value function

Jk at timekfor different points in state space could, therefore, be computed in parallel across

the entire grid. The idea is illustrated in Figure 4.1. We need not manually create clusters

/grids in our 24 core machine. Mathematica will automatically create the grid structure and 2As in Chapter 8 where transaction costs are dependent on the volatility of the market.

4.2. Dynamic programming computations 61

Node k

Node (k+1)

J

k

J

k+1

Computations at point on grid

parallelized

+

+

Figure 4.1: Parallel computation on grids. Value function computation at a point in nodekonly needs to know the value function surface at node (k+1).

distribute tasks in parallel. To do this we could either applyParallelize[]to the outer layer of our program or useParallelTable[]instead ofTable[].

4.2.2

Recursion via dynamic programming

Once a discrete probability approximation is constructed the stage is now set for recursively carrying out the dynamic programming methodology. NestList[]helps us carry out the recur- sion whileInterpolation[]helps us numerically represent a value at each stage of the dynamic program over the state space domain. Depending upon the problem one could try adjusting the order of interpolation so as to achieve a desired level of accuracy. At each stage we could

use Mathematica’sParallelize[] command to increase speed because the value function at a

point in state space only needs to know the value function at the previous stage which is al- ready computed and subsequently represented numerically. To determine optimal controls we

usedMathematica’sbuilt-in routines or created custom optimization routines such as bisection

which could utilize the special nature of the value function such as its concavity or convexity. For example, to solve the type of transaction cost problems we present in Chapter 6, the Mathematica code in appendix A illustrates the initial recursion by proceeding from the last stage. We highlight the salient features of this initial recursion. Here the list tlist1stores for each point in state space the value function and the associated optimal control law (optimal re-balancing point, whether we should re-balance etc). Subsequently JN1 is the numerical representation of the value function obtained after recursion in initial stage.

62 Chapter4. Overview ofMathematicaImplementations

In this way we then proceed sequentially all our way up to the initial time to determine the value function and optimal control law at all the stages.

At each stage we store the optimal control law for each point in state space. This would be helpful in any analysis we would like to carry out. For instance, we might be interested in determining the no-transaction boundaries at a particular stage. TheConvexHull[]function in Mathematica could be useful in 1-D or 2-D provided the no-transaction region is convex. In higher dimensions or for non-convex regions there are third party programs. We have also built our own program for determining the boundaries that relies on constructing small ‘balls’ at points in the no-transaction region and seeing if they are inside the region or not. A large num- ber of ‘balls’ each with a very small radius are constructed at evenly spaced points throughout the no-transaction region domain. If the entire ball lies inside the transaction region then its center is counted as part of the domain of the no-transaction region.

4.2.3

Analysis of the optimal control law

The optimal feedback control law at time step k denoted by ~ζk is now stored and ready for

analysis. As discussed in Section 4.1 it is stored as a function of the state variable in list form as illustrated by the codes in the appendix A. This could easily be achieved by associating each point in state space with a label. So for a point in state space where we buy the point is labeled as1, a point where we sell is labeled as2and a point where we do nothing is labeled as0. By labeling here we mean the internal computer code architecture so that our code knows the optimal control law at each point in state space. Later in the thesis, for example in Figure 9.3 and Figure 9.4, we provide a visual depiction for such an internal labeling for our code. Knowing the optimal control law is very useful, and this allows us to visualize the law by plotting it in asset space. In this way we depict whether the optimal control for the investor is to buy, sell or do no transaction and analyze the resulting geometry.

Storing the control law opens up many potentially useful analyses via thelaw of iterated ex-

pectations. Say we are interested in determining the efficient frontier for the problem described

in Section 3.3 of Chapter 3. We have a lattice with state space (A−

k,W

k) and the relevant vari-

ables already defined. To determine efficient frontier we requireE[Wτ|F0] andVar[Wτ|F0] for

the control law determined by solving the benchmark problem as described. Notice the efficient frontier depends upon F0 and thus the wealth and risky fraction at initial time. As discussed in Section 3.3 by varyingγwe generate the efficient frontier for a particular wealth and risky fraction at the initial time. For a particular value of gamma, risky fraction and wealth at initial time we have a set controls for the solved benchmark problem which we can denote byζ∗.

To obtain a point on the efficient frontier all we must now do is to define φk(A−k,Wk−) =

E[Wτ|Fk] and use the factφk = E[φk+1|Fk] where the expectation is carried under the controls

ζ∗

already determined. We will do recursion on the lattice already described in Section 3.3 but know in this recursion we already know the controls.

Similarly, we can find Var[Wτ|F0] once E[Wτ|F0] has been determined by letting Θ =

E[Wτ|F0] and recursion with the new objectiveVar[Wτ|F0] but the same controlsζ∗.

In brief, three possible ways of computing efficient frontier are :

I- Once the control law ~ζk has been determined computeE[Wτ2|F0] andE[Wτ|F0] using the

4.2. Dynamic programming computations 63

II- Using the control law determineΘ =E[Wτ|F0] and then use it to figure outVar[Wτ|F0]=

E[(Wτ−Θ)2|F0] via the law of iterated expectations.

III. SinceE[(Wτ−γ)2|F0]= E[Wτ2|F0]−2γE[Wτ|F0]+γ2. ComputeE[Wτ2|F0] orE[Wτ|F0]

and then useE[(Wτ−γ)2|F0] to find the pair (Var[Wτ|F0],E[Wτ|F0] ).

There are many possible variations in theMathematicaimplementation of our models and this chapter only highlighted the basics of the implementation4.

In the next chapter we will provide schemes under which solution from a discrete probabil- ity approximation is used to get the solution from the exact distribution.

Chapter 5

Probability deformation continuation

schemes

In the academic literature most of the portfolio theory under transaction cost literature is re- stricted to a continuous-time framework which results inquasi-variationalPartial Differential Equations (PDEs). The objective of this chapter is to create a generic robust and efficient framework that could handle both discrete and continuous models simultaneously. The dis- crete time formulation is a special case of continuous-time formulation. The chapter proposes probability deformation schemes and examines their efficiency. Analysis is restricted to the popular transaction cost frameworks introduced in [28] and [81]. The investment objectives in these papers are different but the transaction cost structure is the same. Transaction cost is proportional to the amount traded.

5.1

Introduction

The fundamental philosophy of deformation solutions is to continuously march our solution from problems that can be easily solved to problems that can’t be easily solved. In particu- lar solving portfolio problems involving exact probability distributions can be a very daunting numerical task. Using exact distributions results in an increase in the computational complex- ity required to attain the desired accuracy in output. There is a work around for this how- ever. Instead of solving problems using exact distributions we will solve problems via discrete approximations of the exact continuous time distributions. The discrete approximations are successively deformed1 so that they provide convergence to the real problem with exact dis-

tribution in some probabilistic sense. This is in essence, the central theme of the chapter as illustrated in Figure 5.1. We are interested in the questions : By making probability models get closer are we making the output from these two models getting close ? Could we determine the output from the target probability model by making the approximate probability model get closer to the target probability model ? This chapter deals with these questions.

Discrete approximations to continuous probability distributions has been active area inde-

cision science( see [47], [46], [79]). Ann-point discrete-distribution approximation consists of

1The word “deformed” would be used a lot by us. Basically we term the approximation of a continous distri-

bution as adeformation process.

5.2. Probability deformation schemes 65

Approx

Continuous

Distribution

Discrete

Distribution

Output 1

Output 2

ÿ

1

Figure 5.1: Two distributions going as an input to the numerical method. They both give an output to the model using same the numerical method. How close are the two outputs ?

nvalues x1,x2, ...,xnand corresponding probabilities of occurrence p1,p2, ...,pn chosen to ap-

proximate the PDF for an underlying continuous random variableX. The approximation could rely on specific features of the original distribution. It could rely on properties like moments or quantiles. Most of the common methods have names like bracket mean, bracket median

andmoment matching( see [47], [46], [79]). The one dimensional definition in the academic

literature could easily be extended to higher dimensions.

The chapter only focuses on the analysis ofprobability deformation schemes.