simulation of two-dimensional fractional brownian...

13
Teknillinen Korkeakoulu ERIKOISTY ¨ O Teknillisen fysiikan koulutusohjelma 26.9.2000 Mat-2.108 Sovelletun matematiikan erikoisty¨ot Simulation of Two-dimensional Fractional Brownian Motion Aleksi Penttinen 45759J

Upload: others

Post on 21-Oct-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

  • Teknillinen Korkeakoulu ERIKOISTYÖTeknillisen fysiikan koulutusohjelma 26.9.2000Mat-2.108 Sovelletun matematiikan erikoistyöt

    Simulation of Two-dimensional FractionalBrownian Motion

    Aleksi Penttinen45759J

  • Preface The work behind this report was made under supervision ofprof. Jorma Virtamo in the Laboratory of Telecommunications Technology. Orig-inally the project was to research the applicability of fractional Browian motionin image compression context. However, as it turned out, the model was notperforming very well for most images and the idea had to be abandoned. Nat-urally, it remained to be solved what kind of images 2dFBM actually produces.The author addressed this problem and implemented a 2dFBM generator andreported the algorithm in this paper.

  • Simulation of Two-dimensional Fractional

    Brownian Motion

    Aleksi Penttinen

    26th September 2000

    Abstract

    Recent studies in telecommunications have brought up fractional Brownian mo-tion (FBM) as a one possible model for packet traffic. To perform simulations todetermine performance and capacity characteristics, it is sometimes necessary togenerate realizations of this process. However, because of the complicated cor-relations involved, generating traces is a heavy computational problem indeed.One approach to reduce the computational burden is to use conditionalized ran-dom midpoint displacement (RMD) method for approximation. In this paperwe present how this method can be generalized to generate 2-dimensional FBMprocesses.

    1 Introduction

    1.1 Properties of 2dFBM

    The two dimensional fractional Brownian motion (2dFBM) considered here,denote with Z, is a mapping of R2+ into R. Let A1, A2 be arbitrary sets on R

    2+

    so that the area of A2 is α times of A1. A normalized 2dFBM process Z with aHurst parameter H ∈ (0, 1) can be defined to be a Gaussian stochastic processwith stationary increments and the property

    Z(A2) ∼ αHZ(A1). (1)

    It is clear that with H = 1/2 the definition reduces to an ordinary 2D Brownianmotion with independent increments. Observe that in 2dFBM the correlationbetween two distinct points depends only on parameter H and the distancebetween the points. More precisely, the relative covariance between values ontwo very small (differential) areas (dx and dy), which differs from the absolutecovariance with a constant multiplier, is determined as Cov[Z(dx), Z(dy)] ∼ 1ra ,where a = 4− 4H and r = |x−y| is the distance between the points. Again, letA1, A2 be some sets on R2+. Now the (relative) covariance between the relatedprocess values can be calculated as:

    Cov[Z(A1), Z(A2)] =∫

    A1

    ∫A2

    1|x− y|a/2 dx dy, x ∈ A1,y ∈ A2. (2)

    1

  • 1.2 Simulation

    When the mutual covariances are known, a vector of values of a 2dFBM can begenerated following the formula for generating values from any Gaussian process[1]. Let Z be a 2dFBM process defined on R2+ and denote z = [z1, . . . , zk], thevalues of {Zi} = {Z(Ai)}, {Ai}i={1...k} ⊆ R2+, and Γ = {Cov[Zi, Zj ]}i,j =E[zzT ], a k × k matrix containing the mutual covariances. By definition valuesof such process on these areas can now be generated by

    z = Γ1/2w, (3)

    where w is k × 1-vector of independent N(0, 1)-distributed random variables.In this presentation, we are interested in generating a realization of n × n

    equally sized square blocks {zij}i,j∈1..n, motivated by the simplicity and flexi-bility of the model and e.g. the pixel structure of computer graphics. Let n beof form 2i, (i ∈ N) for convenience.

    Despite the simplicity of this model, even here the capacity requirementsare enormous. This form of realization leads to determining n2 values of theprocess. Thus generation using the Equation (3) would require a square rootcalculation of a n2 × n2 matrix Γ, which obviously becomes computationallyinfeasible soon as n increases. Furthermore, the values in the matrix are tedious(yet straightforward with Equation (2)) to determine.

    We shall see that these problems can be avoided by applying a hierarchialtop-down algorithm using conditional distributions. This concept was suggestedby Norros et. al. [2] in one dimension for teletraffic modelling.

    The organization of the paper is as follows. In Section 2 we discuss the modeland methods for generating 2dFBM realizations and present a fast and accuratealgorithm for that purpose. The algorithm is then illustrated by graphical exam-ples with different parameter values in Section 3 before we conclude in Section4. Additionally Appendix A is included to suggest alternative techniques for thecovariance calculations for the model.

    2 Two Dimensional Conditionalized Random Mid-point Displacement Method

    2.1 A hierarchial approach

    Instead of generating the whole realization at once, we can use an alternativeapproach and determine the values hierarchically advancing from larger aggre-gates to small details. This means generating layers of increasing resolution asillustrated in Figure 1. Assuming that the process value X on the whole area(Layer 0) is known, we can form a conditional distribution for the next layerand draw the values (x1, x2, x3) from this distribution. The last value x4 is de-termined using the fact that the process value on the parent block (X) equalsto the sum of its children, that is x4 = X−

    ∑3i=1 xi, as it is the same area. (Be-

    low, X and xi will be used to denote parent and child blocks irrespective of thelayer). As the whole layer 1 is now known, we are able to form a correspondingconditional distribution for the next layer. The process can be fully constructedto arbitrarily high resolution layer by layer by applying the same idea. How-ever, the exact conditional distribution on a layer contains all the generated

    2

  • Layer 0

    Layer 3

    XX

    XX XX

    XX XX

    11 22

    33 44

    Layer 1

    Layer 2

    Layer l og n22

    Figure 1: The layer structure of a n× n realization

    blocks (three from each offspring) in condition of all the blocks on that (par-ent) layer. The number of blocks as well as the dimension of this distributionincreases exponentially while adding layers, so the computational limits in timeand memory usage are quickly met. Nevertheless, this approach enables somesimplifications when dealing with process such as 2dFBM, as only the nearestneighbouring blocks have a significant effect on the generated elements. Beforestarting to examine how this observation could be utilized, it is necessary tostate how conditional distributions are determined in the FBM context.

    2.2 Conditional distributions

    One of the most elegant features in FBM models is the simplicity of the con-ditional distributions between different elements. This is due to the Gaussiannature of the process. Requiring only the covariances to be known, the condi-tional distribution is straightforward to determine and even Gaussian. Assumethat a k × 1 vector z consists of two parts (of lenght k1 and k2 respectively)z = [z1T , z2T ]T and we want to know the distribution of z1 when z2 is known.Let Γ be the corresponding covariance matrix E[zzT ] and A = Γ−1. Let A bepartitioned as follows

    A =(

    A11 A12A21 A22

    ),

    where A11 is a square matrix of size k1 × k1 and A22 a square matrix of sizek2 × k2 and A12 = AT21 is a rectangular k1 × k2 matrix. Now the conditionaldistribution of z1 is Gaussian with the mean and variance:

    E[z1|z2] = −A11−1A12z2,E[z1z1T|z2] = A11−1. (4)

    3

  • 1 2

    3 x4

    5

    6 7 8 9

    10 11

    12 13

    Figure 2: A frame for generating children (1,2,3,x) of block (10)

    Assume that a vector of lenght k is to be generated. Let w be a k× 1 vectorof N(0, 1) distributed random numbers and z2 be the values of the areas usedin conditioning. Now the values of z1 can be generated [1] as:

    z1 = E[z1|z2] + E[z1z1T|z2]1/2w. (5)

    This is the formula used in generating process values in the algorithms presentedbelow.

    2.3 Simplifications to the hierarchial model

    The hierarchial model allows us to generate the values for next layer approxi-mately, block by block, leaving out dependencies on the non-existing (not yetgenerated) or distant elements. The main idea in this approach is to construct asmall frame that operates on each block determining the values of the childrenon condition of the information inside the frame. Conceptually the frame is aselection of blocks containing the operated (parent) element, the three childrento be generated and an appropriate collection of neighbouring blocks whose val-ues are known (see Figure 2 for an example of a frame). This frame is used on alayer blockwise from left to right and from top to down (an arbitrary but naturalselection in our case) until the whole next layer is generated. The generation isdone by applying this method on each layer starting from top until the desiredresolution is achieved.

    Mathematically this frame is the normalized covariance matrix of selectedblocks. Normalization is done so that the variance on a basic element is 1. Oncedetermined, the matrix is applicable on every layer l with the scaling factor4H(log2 n−(l+1)) (property (1) of 2dFBM).

    By using a frame we need to know only the covariances inside it, so thatthe matrices used in calculations are relatively small. However, this method stillrequires some covariance calculations which are quite tedious to do using thedefinition (2). This problem is addressed in Appendix A where we present an al-ternative, much faster, recursive algorithm for determining covariances betweenprocess values of square areas.

    4

  • 2.4 Algorithms

    What kind of frame should be selected then? The simplest form is naturally thegeneralization of the RMD bisection method from one dimension. We start fromlayer 0 with picking up the value of the process for the whole area from a stan-dard Gaussian distribution with mean 0 and variance 42H log2 n. The conditionaldistribution of (x1, x2, x3) on each layer depends then only on the their parentvalue X , i.e. the frame contains no neighbouring blocks but only the parent andthe three children (blocks 10, 1, 2 and 3 in Fig. 2). This harsh simplification isjustified by the fact that the impact of the parent block on the generated blockis considerably greater than of any other’s. Although the variance estimate ob-tained with this method is good as will be shown below, the expected value ismore biased which results in realizations with visible block structure (see exam-ples in the next section and the discussion later) as many of the neighbouringblocks have information on each other only from layers above. Nevertheless, thetechnique is simple to implement.

    There are two different approaches to overcome the problems of the simplemethod discussed above. First, the conditioning can be done using a selectionof already generated blocks (as RMDmn in [2]) from the child (blocks on theleft and above in our case) and the parent layer, as in Figure 2. This intro-duces some exceptions to the frame as some neigbouring blocks do not exist forsome elements close to the boundaries of the area. The corresponding rows andcolumns must be dropped from the matrix when using the frame on these borderareas. Despite the increased complexity in implementation, the algorithm is notslowed down. Instead, with enough of the surrounding information available theartificial borders of blocks disappear from the realizations as the means are lessbiased.

    Second enchancement is to start from a more advanced state than the singlevalue for the whole area. Although the definition (3) is not practical in generatingwhole surfaces, it can be used to form a small starting grid {zij}i,j∈1..k of a sizewe can create (e.g. k = 16), setting z = [z11, z12, . . . , z1k, z21, z22, . . . , zkk] in (3)and calculating the corresponding covariances in Γ. At the implementation levelthe symmetry of the matrix can be used effectively for reducing computationaleffort as well as the fact that the covariances between elements of same sizedo not depend significantly on the direction but the distance as the distanceincreases (calculate exactly several short and few long distance covariances andinterpolate the rest for quick use). So, instead of starting the algorithm from asingle block value, we start directly from e.g. layer 4. This reduces the cumulativebias and additionally brings out the advantages in using larger frames as theextra information is fully available only on lower layers, where there is only asmall portion of corner and border blocks.

    2.5 Selecting blocks for the frame

    To illustrate the effect of adding more information in the frame, we examinethe conditional variance of block x4 (on condition X) in the generation process,Var[x4|X ] = Var[X−

    ∑3i=1 xi|X ] =

    ∑3i=1

    ∑3j=1 Cov[xi, xj ], with different values

    of H . This is a natural measure to compare variability caused by different frameselections. Figure 3 shows first the simple RMD (conditioning with block no. 10in Fig. 2), then the result with 5 (blocks 4,5,7,8,10) and finally with 9 (all blocks

    5

  • 0.6 0.7 0.8 0.9 1H

    0.10.20.30.40.50.60.7

    Variance

    9

    5

    1

    Figure 3: Variance of x4

    but 12) blocks in conditioning. It is clearly visible that the increasing informationreduces the variance slightly. This, however, will not improve significantly afteradding more blocks as only the nearest ones have any effect on the conditionaldistribution the rest will being shadowed by the neighbours. When using theblock structure and generation order discussed in this presentation, there ishardly any improvement available with other elements than shown in Figure2. The importance of including as many neighbouring blocks as possible in theframe is in reducing the bias in the mean values of conditional distributions.

    It can be shown that the simple method gives biased realizations and theblock stucture can be mathematically explained. If the frame is completely un-aware of its surroundings, the covariance between the generated and the sur-rounding blocks is significantly lower than in real 2dFBM model. To illustratethis let us examine the covariance of two adjacent 1x1 blocks. Assume that theblocks share a common parent only on n layers above, that is same as assumingthe (n−1)th layer constructed by definition (a real FBM realization). Naturally,when n = 1 the covariance is correct. Let ẑ1 and ẑ2 be the values of the blocksfrom the RMD model, z1 and z2 values for the blocks from an FBM model andfinally Z1 and Z2 be the values of adjacent parent blocks n − 1 layers above(assumed to have correct mutual covariance). Now the covariance between theblocks can be calculated as:

    Cov[ẑ1, ẑ2] =1

    42(n−1)Cov[Z1, Z2]

    =1

    42(n−1)Cov[4H(n−1)z1, 4H(n−1)z2]

    = 4(2H−2)(n−1)Cov[z1, z2].

    Figure 4 shows covariance between the blocks as a function of H with a fewdifferent values for n. It is clear that the covariance differs significantly with allthe sensible selections of H within the FBM framework. Thus, all the possibleneigbouring information that can be easily added to the frame should be thereto avoid discontinuities in the realization.

    6

  • 0.6 0.7 0.8 0.9 1H

    0.2

    0.4

    0.6

    0.8

    1Covariance

    10

    5

    2

    True

    Figure 4: Covariance of neighbouring blocks, when the common parent is 1,2,5or 10 layers above

    3 Examples

    In this Section we present examples of two dimensional FBM realizations. Weillustrate the 2dFBM by generating 64×64 realizations, which leads us to presentan image processing approach to the process: 2dFBM can be considered to relatean area to its amount of black color to produce greyscale fractal surfaces. Thepictures were constructed using the Mathematica software. First, the simpleRMD algorithm starting from a single value for layer 0 is demostrated withdifferent values of parameter H , see Figures 5(a)-5(f). The block structure isclearly visible as discussed earlier. The improved RMD, here with (16 × 16)starting grid and the frame in Figure 2 for conditional distributions. Figures5(g)-5(l) show the results with the same values for H . It is clear that the imagesare smoother and more realistic than those of the simple method.

    4 Conclusions

    As it became clear, generation of two dimensional fractional Brownian motionrealizations is a difficult computational problem. The bottlenecks (in the defini-tion) are the calculation of covariances and determining the square root of thematrix. The first problem was solved by developing a recursive method, whichreturned the four dimensional numerical integration into one dimension. Thesecond problem was bypassed by using approximate hierachial method, follow-ing the footsteps of [2], which allowed using a small matrix at a time containingonly covariances with the closest neighbouring blocks. Combining the solutions,we presented and demonstrated an accurate and fast algorithm for generating2dFBM surfaces to be used e.g. in image processing.

    7

  • (a) RMD H = 0.6 (b) RMD H = 0.8 (c) RMD H = 0.9

    (d) RMD H = 0.95 (e) RMD H = 0.99 (f) RMD H = 0.999

    (g) H = 0.6 (h) H = 0.8 (i) H = 0.9

    (j) H = 0.95 (k) H = 0.99 (l) H = 0.999

    Figure 5: Examples of FBM surfaces

    8

  • Appendix

    A Calculation Of Covariances

    A.1 Variance Calculation

    Let A1 and A2 be sets on R2+. Covariance between Z(A1) and Z(A2) can becalculated using some coordinate transformations. Let n be a vector and denoteAn2 = {x : x ∈ R2,x + n ∈ A2} and A(n) is the area of A1 ∩ An2 . As discussedbefore, the covariance depends on the distance only with differential blocks. Letf(n) be the covariance function (∼ 1/|n|a). Now

    Cov[Z(A1), Z(A2)] =∫

    A1

    ∫A2

    f(n)da1da2, n = a2 − a1,

    Cov[Z(A1), Z(A2)] =∫a1∈A1

    da1

    ∫R2+

    f(n)1a2∈A2 da2

    =∫a1∈A1

    da1

    ∫R2

    f(n)1a1+n∈A2 dn

    =∫n∈R2

    dnf(n)∫R2+

    1a1∈A11a1+n∈A2 da1

    =∫n∈R2

    dnf(n)∫R2+

    1a1∈A1∩An2 da1

    =∫R2

    f(n)A(n) dn, dn = rdrdϕ, f(n) = f(r)

    =∫ 2π

    0

    ∫ ∞0

    rf(r)A(r, ϕ)dr. (6)

    Thus the integral (2) reduces in polar coordinates in a form containing only thearea of intersection of A1 and An2 (A2 moved by the vector −n), and integrationin respect to r and ϕ. This, however, is not generally applicable as the area ofthe intersection can be rather complex to define. Nevertheless, this observationcan be used to calculate variance on a rectangular set which leads to only onenumerical integral. Variance of an area X is the covariance of X with itself. LetX be a rectangular (x × y) area. Now the symmetry enables easy calculationsin polar coordinates as the area of intersection A(r, ϕ) is simple to define, seeFigure 6. Formally,

    Var[Z(X)] = 4∫ π/2

    0

    ∫ ∞0

    r1ra

    A(r, ϕ)dr,

    where A(r, ϕ) = (y − r sin ϕ)+(x − cosϕ)+. Now performing integration withrespect to r analytically we get:

    Var[Z(X)] = x4−a4∫ π/2

    0

    { β2− aR(ϕ)

    2−a − (sin ϕ + β cosϕ) 13 − aR(ϕ)

    3−a +

    sinϕ cos ϕ1

    4− aR(ϕ)4−a}dϕ, (7)

    9

  • XX

    XX

    RR

    Figure 6: Variance of a rectangular area, A(r, ϕ) darkened

    where

    R(ϕ) =

    x

    cosϕϕ ≤ ϕ0

    y

    sinϕϕ ≥ ϕ0

    , tanϕ0 = β =y

    x.

    A.2 A Recursive Method for Covariances

    Due to the property of stationary increments covariance calculation can be re-turned to calculation of variances on rectangular areas. Starting from (the small-est possible) rectangle that covers both two areas whose mutual covariance isto be determined, it is then straightforward to recursively find the desired co-variance using the identity:

    Var[n∑

    i=1

    Z(Xi)] =n∑

    i=1

    n∑j=1

    Cov[Z(Xi), Z(Xj)]. (8)

    Denote now the process value on a i× j rectangle with Z∗(i, j) and the corre-sponding variance with v(i, j). The covariance of two 1 × 1 square blocks with[i, j] units between the lower left corners (denote with c(i, j)) can be solvedrecursively, as the variances are known, from:

    v(i + 1, j + 1) =i∑

    i1=0

    j∑j1=0

    i∑i2=0

    j∑j2=0

    c(|i2− i1|, |j2− j1|). (9)

    And covariance between any two rectangular blocks can be calculated in similarfashion using the 1× 1 covariances obtained previously:

    Cov[Z∗(a1, a2), Z∗(b1, b2)] =a1∑

    i1=0

    b1∑j1=0

    a2∑i2=0

    b2∑j2=0

    c(|i + b1− a1|, |j + b2− a2|).

    Covariances have simple analytical reprensentations in respect to variances onsome rectangular areas after combining equal terms in recursion.

    10

  • An example. The idea formulated above is demonstrated here with an exam-ple. Assume that the covariance c(1, 2) (Cov[z1, z6] in the figure below) is to bedetermined. We start with writing v(2, 3) = Var[Z∗(2, 3)] =

    ∑i

    ∑j Cov[zi, zj ].

    z1

    z6

    z1

    z6

    v(2, 3)z1

    z6

    z3

    z2

    z5

    z4

    We observe that Var[zi] = v(1, 1) and naturally Cov[zi, zj ]=Cov[zj, zi]. Usingthe Formula (9) again for smaller aggregates, we will get by simplifying andcombining equal terms:

    Cov[z1, z6] =14v(2, 3)− 1

    2v(2, 2)− 1

    2v(1, 3) +

    54v(1, 2)− 1

    2v(1, 1).

    So we have managed to reduce the complicated covariance calculation into anexpression containing only variances, which can be easily determined using theformula in the previous section and even tabulated for quick use. In Mathematicathis recursion can be done with only a few lines;

    v[a_,b_]:=v[b,a]/;a>b

    c[0,0]=v[1,1];

    c[a_,b_]:=c[b,a]/;a>b

    c[i_, j_] := Expand[h[i, j] /. First[Solve[v[i+1, j+1] ==Sum[h[Abs[i2-i1], Abs[j2-j1]], {i1, 0, i}, {j1, 0, j},{i2, 0, i}, {j2, 0, j}], h[i, j]]] /. h -> c]

    References

    [1] I. Norros, J. Virtamo: Handbook of FBM formulae, COST257TD(96),September 1996.

    [2] I. Norros, P. Mannersalo, J.L. Wang: Simulation of Fractional BrownianMotion with Conditionalized Random Midpoint Displacement, Advances inPerformance Analysis. Vol. 2 (1999) No: 1, 77 - 101

    11