• No results found

Discrete inverse sampling (DIS)

4.2.1 Sampling from the discrete density approximation

Given the non-probabilistic nature of wavelets ψj,i, treating them as probability

distributions might sound a bizarre idea. However, as demonstrated in the theory of WMC, after normalisation of ψ+

j,i and ψ −

j,i new samples need to be drawn from these

parts in order to proceed through the WMC algorithm. In this section a method for producing samples from ψ+

j,i and ψ −

j,i will be covered.

Let us discretise both ψ+

j,i(·) and ψ −

j,i(·). Denote the support Ij,i = [a, b] =

supp{ψj,i(·)}. We will denote the discretised version of the interval Ij,i by

x =  x1 = a, x2 = a+ (b − a) n , x3 = a+ 2(b − a) n , ..., xn = a+ (n − 1)(b − a) n , xn+1= b  . (4.2.5) We will also dene vectors Ψ+ and Ψ−, which contain the evaluations of ψ+

j,i(·) and

ψj,i−(·) at points of x:

Ψ+=ψj,i+(x1), ψj,i+(x2), ..., ψj,i+(xn+1)



, (4.2.6)

Ψ−=ψj,i−(x1), ψj,i−(x2), ..., ψj,i−(xn+1)



. (4.2.7)

By setting a large value of n, numerical integration could be performed using Ψ+,

Ψ−, x and δx = b−an as a nite dierential to get a value of the normalisation constant Aj of the functions ψj,i+(·) and ψ

j,i(·). By applying cumulative sums to

elements of vectors Ψ+ and Ψ, a discretised version of the cumulative distribution

functions P+ and Pfor densities ψ+

j,i(·)/Aj and ψj,i−(·)/Aj can be obtained:

P− =p−l = l X k=1 ψj,i−(xk)δx n+1 l=1 , (4.2.8) P+=p+ l = l X k=1 ψj,i+(xk)δx n+1 l=1 . (4.2.9)

We shall now assemble a discrete version of an inverse sampling algorithm (DIS) which can be performed on vectors P+ and Pto produce samples from ψ+

j,i(·)/Aj

and ψ−

j,i(·)/Aj.

4.2.2 Pseudo code

Steps for producing samples from positive and negative parts of the wavelets will be presented here.

0. Obtain values of x, P+ and P+.

1. Sample u ∼ U[0, 1] and compute k+

min for producing a sample from ψ + j,i(·)/Aj

kmin+ = arg min

k∈{1,2,...,n+1}

|p+

k − u|, (4.2.10)

or compute k−

min for producing a sample from ψ − j,i(·)/Aj

kmin− = arg min

k∈{1,2,...,n+1}

|p−k − u|. (4.2.11)

2. Having obtained k+

min or k −

min, we report samples from positive and negative

parts of the wavelet ψj,i to be

xk+ min ∼ ψ + j,i(·)/Aj, xk− min ∼ ψ − j,i(·)/Aj, (4.2.12)

where values xk+min and xk−min are the appropriate entries of vector x.

4.2.3 DIS in d dimensions

Here we will demonstrate how the DIS algorithm can be applied for sampling from a multidimensional wavelet ψj,i(x). Here x ∈ Rd, j = {j1, j2, ..., jd} and

that the construction of a multidimensional wavelet involves taking a product of wavelets {ψjk,ik(xk)}

d k=1:

ψj,i(x) = ψj1,i1(x1)ψj2,i2(x2) · · · ψjd,id(xd). (4.2.13)

Now we are interested in nding the normalisation constant

Aj = Z x∈Rd ψj,i+(x) dx = Z x∈Rd ψ−j,i(x) dx. (4.2.14) Given that Ajk = Z +∞ −∞ ψj+ k,ik(xk) dxk= Z +∞ −∞ ψ−j k,ik(xk) dxk, (4.2.15)

we only need to work out how many terms there are in the expanded version of [ψj1,i1(x1)ψj2,i2(x2)...ψjd,id(xd)]

+ and [ψ

j1,i1(x1)ψj2,i2(x2)...ψjd,id(xd)]

to get the

expression of Aj.

We observe that given a product ψj,i(x) of length d, where each term could have

a sign of +1 or −1, there are 2d possible combinations of signs in a product. The

value of a sign sub-product of the rst (d − 1) terms is either +1 or −1, therefore only the last term in a product determines whether ψj,i(x) > 0 or ψj,i(x) < 0. For

this reason [ψj,i(x)]+ and [ψj,i(x)]− will both have 2d−1 terms in the expanded form.

Combining this observation with (4.2.15), we get that

Aj = 2d−1 d Y k=1 Ajk = 2 d−1−12Pd k=1jkAd 0, (4.2.16)

where we have used Ajk = 2

−jk/2A

0. Now, given the normalisation constant, how

do we produce samples from [ψj,i(x)]+/Aj and [ψj,i(x)]−/Aj? We sample a d − 1

dimensional vector of signs sk from a Bernoulli distribution,

{sk}d−1k=1 ∼ 0.51(s = −1) + 0.51(s = +1). (4.2.17)

We sample

xk∼ [ψjk,ik(xk)]

sk/A

where sk denotes a sign. Now, if we are interested in producing a sample from [ψj,i(x)]+/A j, sample xd ∼    [ψjd,id(xd)] +/A jd if Q d−1 k=1sk = 1; [ψjd,id(xd)] −/A jd otherwise, (4.2.19)

and let x = (x1, x2, ..., xd) be a sample from [ψj,i(x)]+/Aj. However, if we are

interested in producing a sample from [ψj,i(x)]−/Aj, then

xd ∼    [ψjd,id(xd)] −/A jd if Q d−1 k=1sk = 1; [ψjd,id(xd)] +/A jd otherwise, (4.2.20)

and x = (x1, x2, ..., xd) will be a sample from [ψj,i(x)]−/Aj.

As we can see, the independent product structure of a multidimensional wavelet allows for quite convenient sampling procedures. This method for producing samples from positive and negative parts of wavelets could be used in the future to implement WMC in a multidimensional setting.