approximating solutions of stochastic differential equations with gaussian … · 2016-03-11 ·...

49
Approximating Solutions of Stochastic Differential Equations with Gaussian Markov Random Fields Geir-Arne Fuglstad TMA4500 - Industrial Mathematics, Specialization Project Fall 2010 December 19, 2010

Upload: others

Post on 10-Jun-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Approximating Solutions of Stochastic DifferentialEquations with Gaussian Markov Random Fields

Geir-Arne FuglstadTMA4500 - Industrial Mathematics, Specialization Project

Fall 2010

December 19, 2010

Page 2: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov
Page 3: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Preface

This report is a part of the subject ”TMA4500 - Industrial Mathematics, SpecializationProject” at the Norwegian University of Science and Technology. The subject is a 15credit subject and the grade is determined only by this final report.

The subject has given the author insight into a more independent type of work than inprevious courses at the university. The responsibility for steady progress and completionof the project within the deadline falls mainly on the student. Further the project hasallowed work into a new and exciting problem field.

The author wishes to thank the supervisors Håvard Rue and Finn Lindgren for theirhelp and valuable experience.

i

Page 4: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

ii

Page 5: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Abstract

A solution of a stochastic differential equation on a bounded domain can be approximatedby its joint distribution on a finite discretization of the domain. By creating a GaussianMarkov random field which approximates this joint distribution, properties of GaussianMarkov random fields which allow fast simulation and inference can be used.

The construction of a Gaussian Markov random field which approximates the jointdistribution has previously been done for non-stationary stochastic differential equations.This report creates one such approximation for a non-stationary stochastic differentialequation.

First an example of a an earlier approximation for second-order random walk issummarized and an example of how such a model can be applied as part of a largermodel, in smoothing of time series, is demonstrated. Then a Gaussian Markov randomfield approximation is constructed for the stochastic heat equation

∂tu(x, t) =

∂2

∂x2u(x, t) + σW(x, t),

where σ > 0 is a constant and W(x, t) is space-time white noise, on a rectangular domainunder the Neumann boundary conditions of zero derivative with respect to x at the spatialboundaries.

The approximation uses a finite volume method with an implicit Euler method intime and shows good results for two different type of initial conditions and merits furtherinvestigation.

iii

Page 6: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

iv

Page 7: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iAbstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

1 Introduction 1

2 Gaussian Markov random fields 32.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32.2 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.3 Sparse precision matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.4 Marginal variances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.5 Permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.6 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

3 Second-order random walk 133.1 Stochastic differential equations . . . . . . . . . . . . . . . . . . . . . . . . 133.2 Second-order random walk as an SDE . . . . . . . . . . . . . . . . . . . . 13

3.2.1 Approximation of the solution . . . . . . . . . . . . . . . . . . . . . 143.3 Smoothing of time series by second-order random walk . . . . . . . . . . . 15

3.3.1 Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.3.2 Effect of scale parameter . . . . . . . . . . . . . . . . . . . . . . . . 163.3.3 Effect of model variance . . . . . . . . . . . . . . . . . . . . . . . . 163.3.4 Example 1: Missing data . . . . . . . . . . . . . . . . . . . . . . . 183.3.5 Example 2: Square wave with white noise . . . . . . . . . . . . . . 183.3.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

4 Stochastic heat equation 234.1 Finite volume methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234.2 Stochastic partial differential equation . . . . . . . . . . . . . . . . . . . . 23

4.2.1 Boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . 244.2.2 Approximation by a finite volume method . . . . . . . . . . . . . . 24

4.3 Properties of the approximation . . . . . . . . . . . . . . . . . . . . . . . . 274.3.1 The precision matrix . . . . . . . . . . . . . . . . . . . . . . . . . . 274.3.2 Total energy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284.3.3 Initial condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

v

Page 8: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

vi CONTENTS

4.4 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.4.1 Second-order random walk as initial condition . . . . . . . . . . . . 314.4.2 Fixed initial condition . . . . . . . . . . . . . . . . . . . . . . . . . 34

4.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5 Conclusion 39

Bibliography 41

Page 9: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Chapter 1

Introduction

Previous work has been done by [6] to create a Gaussian Markov random field whichapproximates the solution of a second-order random walk on an irregular grid. In addi-tion [5] has demonstrated how a Matérn random field on a sphere can be approximatedby a Gaussian Markov random field. Both these examples are approximations of thesolution of a stationary stochastic differential equation on some domain.

The problem considered in this report is to construct such a Gaussian Markov randomfield approximation to a non-stationary stochastic differential equation.

The use of Gaussian Markov random fields for the approximations means that con-ditional independence between variables gives sparse precision matrices. This sparsityenables the use of numerical tools for sparse matrices to do more efficient simulation andinference. Chapter 2 gives a brief introduction to Gaussian Markov random fields andshows how the sparsity of the precision matrix can be used to improve the efficiency ofsimulation and calculation of marginal variances. In addition it gives an example of howa permutation of the variables may greatly increase the sparsity of the Cholesky factorof the precision matrix.

Chapter 3 gives a summary of how the approximation in [6] was constructed for thesecond-order random walk on an irregular grid. Then an example of how this approxi-mation can be applied to smoothing of time series is demonstrated.

Lastly Chapter 4 considers further development of these types of approximations tonon-stationary stochastic partial differential equations, by constructing one such approx-imation for a form of the stochastic heat equation. This is accomplished by the use ofa finite volume method and the result is tested with a fixed initial condition and withsecond-order random walk as initial condition.

The report ends with some conclusions in Chapter 5.

1

Page 10: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

2 CHAPTER 1. INTRODUCTION

Page 11: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Chapter 2

Gaussian Markov random fields

2.1 Definition

Gaussian Markov random fields are a type of Gaussian random fields. A Gaussian randomfield can be defined as follows.

Definition 2.1.1 (Gaussian random field (GRF)). Let D ⊂ Rn, then the random field

{x(t) : t ∈ D} is said to be a Gaussian random field if for all m ∈ N for all choices ofpoints t1, . . . , tm ∈ D, (x(t1), . . . , x(tm)) has a multivariate Gaussian distribution.

For the rest of this section the interest will lie in GRFs on some finite set of points,which without loss of generality can be numbered from 1 to n. Call this set V = {1, . . . , n}and consider the GRF {x(t) : t ∈ V}. As V is finite, one can consider the joint distributionof all x(ti) for i ∈ V, which by definition is a multivariate Gaussian distribution. Assumethe covariance matrix of the distribution, Σ, is symmetric positive definite and let Q =Σ−1. This matrix is called the precision matrix of the distribution. The following theoremfrom [7] characterizes the relationship between conditional independence of x(i) and x(j)for i, j ∈ V and element Qi,j of the precision matrix.

Theorem 2.1.1 (From [7]). Let x have a multivariate Gaussian distribution with meanμ and precision matrix Q > 0. Then for i �= j, x(i)|{x(k) : k ∈ V−{i, j}} is independentof x(j)|{x(k) : k ∈ V − {i, j}} if and only if Qi,j = 0.

From a GRF on V = {1, . . . , n} an undirected graph G can be constructed with V asthe set of vertexes and the set of edges, E , defined by {i, j} ∈ E if and only if x(i) andx(j) are not conditionally independent. Since all graphs will be undirected, the termgraph will be used to mean an undirected graph from this point on. A formal definitionfor a Gaussian Markov random field can be made by reversing this type of constructionand first specifying the conditional independence structure, i.e. the graph.

Definition 2.1.2 (Gaussian Markov random field (GMRF) [7]). A random vector x ∈ Rn

is called a Gaussian Markov random field with respect to a labeled graph G = (V, E) with

3

Page 12: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

4 CHAPTER 2. GAUSSIAN MARKOV RANDOM FIELDS

mean μ and precision matrix Q > 0, if and only if its density is of the form

π(x) =1

(2π)n/2|Q|1/2 exp

(−1

2(x− μ)TQ(x− μ)

), (2.1)

and for all i �= j, Qi,j �= 0 if and only if {i, j} ∈ E .

From this definition one can see that a general GRF (on a labeled graph) is a GMRFif one choses the edges in E according to the non-zero elements of Q. In the rest of thereport the underlying graph will be suppressed in the notation for GMRFs unless it isexplicitly needed.

Definition 2.1.2 only allows Q > 0, but also GMRFs with positive semi-definite pre-cision matrices will be allowed. The lack of positive definiteness means that there arelinear combinations of the elements of the random vector x which has unbounded vari-ance. This means that the distribution is not proper, but it can be used as a priordistribution if the posterior distribution is proper and one can draw samples from thedistribution conditioned on that the linear combinations with unbounded variance arezero. More specifically all linear combinations aTx such that a ∈ Null(Q) must bezero. Let e1, . . . , ek be an orthonormal basis for the null space, then x|Ax = 0, withA = [e1, . . . , ek]

T, is a proper distribution and can be sampled.

2.2 Simulation

Simulations from a GMRF can be done by first Cholesky factorizing the precision matrixQ and then solving a linear system as the following theorem shows.

Theorem 2.2.1. A simulation from the GMRF, x, with mean μ and precision matrixQ > 0 can be made by first drawing z ∼ Nn(0, In) and then solving

LT(x− μ) = z,

where L corresponds to a Cholesky decomposition Q = LLT.

Proof. Let z ∼ Nn(0, In) and LT(x− μ) = z, where L is the Cholesky factor of Q. L isinvertible because Q is invertible, therefore

Cov(LTx) = Cov(z)

LTCov(x)L = In

Cov(x) = (LLT)−1 = Q−1.

Further x is Gaussian as it is a linear combination of Gaussian iid variables, its covarianceis correct from above and its expectation is μ since E(z) = 0.

Page 13: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

2.3. SPARSE PRECISION MATRIX 5

2.3 Sparse precision matrix

Let x be a GMRF with precision matrix Q and mean zero. Simulation by Theorem 2.2.1requires the computation of a Cholesky decomposition and the solution of a system oflinear equations of the form LTx = z, where L is lower triangular. This means that theefficiency of the simulation is determined by the efficiency of the Cholesky decompositionand of the solution of the linear system.

For a general (positive definite) precision matrix, the lower triangular matrix L ofthe Cholesky decomposition can be calculated recursively, column-wise by the formula

Li,j =

⎧⎪⎪⎪⎪⎨⎪⎪⎪⎪⎩

√Qi,i −

i−1∑k=1

L2j,k i = j

1Lj,j

(Qi,j −

j−1∑k=1

Li,kLj,k

)i > j

. (2.2)

This recursive formula requires O(n3) floating point operations and the solution of theequation LTx = z requires O(n2) floating point operations.

However, if Q is sparse the Cholesky factor will often be sparse. Thus if one couldknow a priori which elements of L that were zero, it would not be necessary to calculatethose elements and it would not be necessary to include them in the summands in therecursive formula. Consider for example the case that one knew that the Cholesky factorwould have a lower bandwidth of 1, then only 2n − 1 terms needs to be calculated andall the sums in the recursive formula would have a maximum of one term. Thus theCholesky decomposition could be calculated with O(n) floating point operations.

This improvement in asymptotic computational cost motivates the search for generalconditions for whether an element Li,j is zero or not. To continue this train of thoughtit is useful to consider the underlying graph of the GMRF, denote this by G = (V, E),where V is the nodes and E is the edges. It would be preferable to be able to determinethe non-zero elements directly from the graph, that is only based on the knowledge ofwhich Qi,j that are non-zero. This is not possible, but it is possible to find sufficientconditions based on the graph.

The proof of the sufficient condition requires the use of a different type of Markovproperty than considered previously. Previously in Theorem 2.1.1 the pairwise Markovproperty was considered. GMRFs also have another Markov property that is called theglobal Markov property. The two different properties are illustrated in Figure 2.1.

Lemma 2.3.1 (Global Markov property). Let x be a zero mean GMRF with precisionmatrix Q > 0 and let G = (V, E) be the associated labeled graph. Let A,B,C ⊂ V be non-empty pairwise disjoint sets. If C separates A and B, that is all paths from an elementin A to an element in B must go through C, then {x(i) : i ∈ A} and {x(i) : i ∈ B} areindependent conditioned on {x(i) : i ∈ C}.Proof. Let Y1 be the set of all elements of V than can be reached from A without enteringC and Y2 the set of all elements of V that can be reached from B without entering C.

Page 14: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

6 CHAPTER 2. GAUSSIAN MARKOV RANDOM FIELDS

(a) The pairwise Markov property.There is no edge between the twogrey nodes, therefore they are inde-pendent conditioned on the blacknodes.

(b) The global Markov property.The black nodes separate the twocollections of grey nodes, that isthere is no path between the twocollections which does not crossthe black nodes, therefore the twocollections are independent condi-tioned on the black nodes.

Figure 2.1: The two sub-figures illustrates the pairwise Markov property and the globalMarkov property, respectively.

These sets are disjoint because C separates A and B. Let Y3 be all elements not in Y1or Y2, this set includes C.

Write the distribution of x as

π(x) ∝ exp

(−1

2xTQx

).

Write out xTQx =∑

i,j xixjQi,j and use that Qi,j = 0 when i and j are in different setsamong Y1, Y2 or Y3 − C. This is because the sets are separated by C. The quadraticform can be written

xTQx =∑

i,j∈Y1

xixjQi,j + 2∑

i∈Y1,j∈CxixjQi,j +

∑i,j∈Y2

xixjQi,j + 2∑

i∈Y2,j∈CxixjQi,j +K,

(2.3)where K only depends on x(i) for i ∈ Y3.

In Equation (2.3) the first two terms only involve elements in Y1 and C, the thirdand fourth terms only involve elements in Y2 and C and K only involves elements in Y3.Thus the joint distribution can be factored into one factor only involving Y1 (and C),one factor only involving Y2 (and C) and one factor only involving Y3.

This means that the joint distribution for {x(i) : i ∈ Y1} and the joint distributionfor {x(i) : i ∈ Y2} are independent conditioned on {x(i) : i ∈ C}. This implies that{x(i) : i ∈ A} and {x(i) : i ∈ B} are independent conditioned on {x(i) : i ∈ C}.

Page 15: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

2.3. SPARSE PRECISION MATRIX 7

By using this lemma a sufficient condition for Li,j = 0 based only on the underlyinggraph of the GMRF can be proved.

Theorem 2.3.2. Let x be a GMRF with mean zero and precision matrix Q > 0 corre-sponding to the graph G = (V, E) and let F (i, j) = (i+1, . . . , j−1, j+1, . . . , n) for i < j.If F (i, j) separates i and j, that is if all paths between i and j must pass through F (i, j),then Lj,i = 0.

Proof. Let L be a lower triangular matrix such that Q = LLT and let xi:n = (xi, xi+1, . . . , xn)and zi:n = (zi, . . . , zn), where z has a multivariate standard Gaussian distribution.

By Theorem 2.2.1 LTx ∼ z. This implies that xi:n can be found by backwardssubstitution from zi:n, which means that the distribution of xi:n is determined only byzi:n and that

π(xi:n) = π(zi:n) ∝ exp

(−1

2(LTx)Ti:n(L

Tx)i:n

).

But if y = LTx, then yk =∑n

l=k Ll,kxl. The only element of yi:n with both an xi andan xj term is yi, but the only cross-term in y2i is 2Li,iLj,ixixj . This means that if Qi:n

is the precision matrix of xi:n, then Qi:nj−i+1,1 = Lj,iLi,i.

The global Markov property of x from Lemma 2.3.1 means that since F (i, j) separatesxi and xj , xi and xj are independent conditioned on xF (i,j). By Theorem 2.1.1 this impliesLj,iLi,i = Qi:n

j−i+1,1 = 0.Further Q > 0 implies L > 0 which means Ll,l > 0 for l = 1, . . . , n. Thus Lj,i = 0.

In the proof of the previous theorem one can see that the sufficient and necessarycondition for Lj,i = 0 is xi independent of xj conditioned on xF (i,j), but this is in generalinconvenient to determine when xi and xj are not separated by xF (i,j). Therefore it willnot be given its own theorem. By using Theorem 2.3.2 the relationship in Equation (2.2)can be used to create a recursive formula which does not calculate things which areknown to be zero.

Corollary. Let x be a GMRF with precision matrix Q > 0, let F (i, j) = {i+ 1, . . . , j −1, j +1, . . . , n} for i < j, let I(i) = {k : k > i, k and i not separated by F (i, k) } and letK(i) = {k : k < i, k and i not separated by F (k, i) }. Then the non-zero elements of theCholesky factor, L, can be calculated by Algorithm 1.

Proof. Use Theorem 2.3.2 to remove everything unnecessary from the relation in Equa-tion (2.2).

A simple example illustrates how powerful Theorem 2.3.2 can be.

Example 2.3.1 (First order autoregressive process). Consider the time series xt =0.5xt−1 + εt for t = 1, . . . , n, where x0 is a constant and εt is iid Gaussian white noise.Then F (i, j) separates i and j if and only if j − i > 1. By Theorem 2.3.2 Lj,i is zerofor j − i > 1 and L has a lower bandwidth of 1. Thus the Cholesky factorizationonly requires O(n) floating point operations. Further the low bandwidth can be taken

Page 16: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

8 CHAPTER 2. GAUSSIAN MARKOV RANDOM FIELDS

Data: matrix Q > 0Result: Cholesky factor Lfor i ← 1 to n do

Li,i ←√

Qi,i −∑

k∈K(i)

L2i,k;

for increasing j in I(i) do

Lj,i ← 1Li,i

(Qj,i −

∑k∈K(i)∩K(j)

Li,kLj,k

);

endend

Algorithm 1: Calculate the Cholesky factor of an SPD sparse matrix.

advantage of in Theorem 2.2.1, because LT(x − μ) = z can be solved for x by O(n)floating point operations. This means that a simulation can be made with O(n) floatingpoint operations.

2.4 Marginal variances

Based on a general n × n precision matrix Q > 0 it is costly to compute the marginalvariances, because this requires the inversion of the matrix Q and inversion generallyrequires O(n3) floating point operations. It is, however, possible to take advantage ofthe possibly sparse structure of Q and only compute a partial inverse, in the sense thatnot all elements of the inverse matrix are computed.

The following relationship can be found in [3, chapter 12].

Lemma 2.4.1. Let Q be a symmetric positive definite matrix and let Σ = Q−1. Let Lbe the Cholesky factor of Q, then

Σi,j =δi,jL2i,i

− 1

Li,i

n∑k=i+1

Lk,iΣk,j , j ≥ i, (2.4)

where δi,j = 1 for i = j and 0 otherwise.

Proof. Let Q = LLT > 0, then

LTΣ = LT(LLT)−1 = L−1.

Further L−1 is lower triangular and (L−1)i,i = 1/Li,i. Thus

n∑k=i

Lk,iΣk,j =1

Li,iδi,j , j ≥ i,

which is equivalent to Equation (2.4).

Page 17: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

2.4. MARGINAL VARIANCES 9

[3, chapter 12] shows that this relationship can be used to compute the elementsof the covariance matrix recursively and that it is not always necessary to calculate allthe terms to find the marginal variances. In fact the reference shows that one onlyneeds to calculate the diagonal of Σ and the Σi,j which corresponds to i < j for whichLj,i was calculated in Algorithm 1. The details can be found in the reference, but theargumentation will be summarized in a theorem.

Theorem 2.4.2. Let x be a GMRF with precision matrix Q > 0, let F (i, j) = {i +1, . . . , j − 1, j + 1, . . . , n} for i < j and let

I(i) = {k > i : i and k not separated by F (i, k)},for i = 1, . . . , n.

Then Σi,j for {i, j} ∈ {{i, j} : i ∈ I(j) ∪ {j}, j = 1, . . . , n} can be computed byAlgorithm 2.

Data: matrix Q > 0 and Cholesky factor, L, of QResult: partial inverse, Σ, of Qfor i ← n to 1 do

for decreasing j in I(i) ∪ {i} doΣi,j ← δi,j

L2i,i

− 1Li,i

∑k∈I(i)

Lk,iΣk,j ;

Σj,i ← Σi,j ;end

endAlgorithm 2: Calculate the partial inverse of an SPD sparse matrix.

Proof. For j > i Theorem 2.3.2 gives Lj,i = 0 if F (i, j) separates i and j. This is true iffj ∈ I(i). Therefore the sum in Lemma 2.4.1 only needs to be taken over I(i), that is

Σi,j =δi,jL2i,i

− 1

Li,i

∑k∈I(i)

Lk,iΣk,j ,

for j ≥ i.Fix i ∈ {1, 2, . . . , n} and j ∈ I(i) ∪ {i} then Σi,j can be computed iff Σk,j is known

for all k ∈ I(i). That means it is sufficient that Σk,l is known for all k, l ∈ I(i) ∪ {i},where not both k and l are equal to i.

Let k ∈ I(i) ∪ {i}. Then either k = i or k ∈ I(i), which means that k and i arenot separated by F (i, k), which means there is a path from i to k using only the nodes{1, . . . , i}.

Let k, l ∈ I(i) ∪ {i}, with not both k and l equal to i, and assume without loss ofgenerality that k ≤ l. If k = l �= i, then Σk,k is calculated in iteration n − k + 1 of thefirst for-loop.

If k < l, then k = i or there is a path from k to i using only nodes in {1, . . . , i} andthere is a path from i to l using only nodes in {1, . . . , i}. Thus there is a path from k to

Page 18: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

10 CHAPTER 2. GAUSSIAN MARKOV RANDOM FIELDS

l using only the nodes {1, . . . , i} and k and l are not separated by F (k, l). This meansthat Σk,l is computed in iteration n− k + 1 of the first for-loop, since l ∈ I(k).

Therefore all necessary elements of Σ are known at each iteration and the algorithmcalculates all Σi,j and Σj,i for i ∈ {1, 2, . . . , n} and j ∈ I(i) ∪ {i}.

Remark (Non-zero pattern of the Cholesky factor). Note that Theorem 2.4.2 does notstate that the only elements of Σ that has to be calculated is the diagonal elements of Σand the elements Σi,j with i < j that corresponds to Lj,i �= 0. The theorem states thatonly the Σi,j which corresponds to an Lj,i which is known to be 0 since it satisfies thesufficient condition in Theorem 2.3.2 does not need to be calculated.

Theorem 2.3.2 only specifies a sufficient condition and Lj,i for i < j can be 0 eventhough i and j are not separated by F (i, j). If Lj,i = 0 by mistake is assumed to implythat i and j are separated by F (i, j) Algorithm 2 may fail because an element of Σ whichis needed has not been calculated.

Let x be a GMRF which corresponds to a graph with four vertexes and edges betweenany two vertexes. Assume for example that the precision matrix, Q, is the positive definitematrix given by

Q =

⎡⎢⎢⎣1 1 1 11 5 1 31 1 5 51 3 5 31

⎤⎥⎥⎦ .

This matrix is dense, but the Cholesky factor

L =

⎡⎢⎢⎣1 0 0 01 2 0 01 0 2 01 1 2 5

⎤⎥⎥⎦

has a non-zero element below the diagonal even though there is no i < j such that i andj are separated by F (i, j).

Assume that Algorithm 2 is used to calculate the partial inverse and that one fromL falsely concludes that 2 and 3 are separated by F (2, 3). Then when calculating Σ1,3,Σk,3 is needed for k ∈ I(1). But I(1) = {2, 3, 4} since L2,1, L3,1 and L4,1 are non-zero.Σ4,3 is found from the symmetry Σ4,3 = Σ3,4, but Σ2,3 has never been calculated since itwas assumed that 2 and 3 were separated by F (2, 3). Thus it is impossible to calculateΣ1,3 and the recursive formula stops.

This shows that the set of Σi,j terms that needs to be calculated should be determinedfrom Q and not directly from L. This is an important point when using a third-partylibrary for the calculation of the Cholesky factor as it may remove elements which arezero or close to zero. Thus either a library which creates a symbolic factorization, thatis determines which elements of L that must be zero only from the non-zero pattern ofQ, or a library which leaves explicit zeros in the the Cholesky factor is needed.

Page 19: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

2.5. PERMUTATIONS 11

1 2 3 4 5

Figure 2.2: An example of a GMRF with a sparse Cholesky factor.

2.5 Permutations

The number of floating point operations and the memory needed for the Cholesky de-composition of a sparse matrix Q > 0 will depend on the pattern of the non-zero elementsof Q. Thus it may be beneficial to do a pre-permutation of the form PQPT, where P isa permutation matrix. This corresponds to reordering the vector x to Px in definition2.1.2 and gives a new GMRF.

Example 2.5.1 (Simple graph). The reordering of the elements of a GMRF or equiv-alently the underlying graph can have dramatic consequences on the sparsity of theCholesky factor of the precision matrix. Figure 2.2 and and Figure 2.3 shows two differ-ent orderings of the same GMRF.

The Cholesky factor from Figure 2.2 has the following sparsity structure

L =

⎡⎢⎢⎢⎢⎢⎢⎣

∗ 0 0 0 0 00 ∗ 0 0 0 00 0 ∗ 0 0 00 0 0 ∗ 0 00 0 0 0 ∗ 0∗ ∗ ∗ ∗ ∗ ∗

⎤⎥⎥⎥⎥⎥⎥⎦,

where * denotes a possibly non-zero elements.The Cholesky factor from Figure 2.3 has the following sparsity structure

L =

⎡⎢⎢⎢⎢⎢⎢⎣

∗ 0 0 0 0 0∗ ∗ 0 0 0 0∗ ∗ ∗ 0 0 0∗ ∗ ∗ ∗ 0 0∗ ∗ ∗ ∗ ∗ 0∗ ∗ ∗ ∗ ∗ ∗

⎤⎥⎥⎥⎥⎥⎥⎦,

where * denotes a possibly non-zero elements.This shows that the permutation of a GMRF can drastically change the sparsity

structure of the GMRF.

The example shows that there is a need for algorithms to minimize the number ofnon-zero elements of the Cholesky factor of the precision matrix. There exists different

Page 20: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

12 CHAPTER 2. GAUSSIAN MARKOV RANDOM FIELDS

1 2 3 4 5

Figure 2.3: An example of a GMRF with a dense Cholesky factor.

strategies and algorithms for finding orderings of the variables of the GMRF which try tominimize the number of non-zero entries in the Cholesky factor. The efficient algorithmsdo not guarantee a minimum number of non-zeros elements. [7, chapter 2] gives anintroduction to some of these algorithms.

2.6 Implementation

For this project the author used the CHOLMOD library [1] for Cholesky decompositionand solution of equations of the type Ax = b and LTx = b and the EIGEN library [4] forgeneral sparse matrix operations. CHOLMOD is a C library and EIGEN is a templatelibrary for C++.

Code for simulation and calculation of marginal variances for GMRFs with sparseprecision matrices was written in C++, and some code was written in MATLAB forquicker testing of new ideas. In the C++ implementation the automatic choice of thepermutation of the matrix in CHOLMOD for the Cholesky decomposition was used. Thiscode was used to generate the results in later chapters.

Page 21: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Chapter 3

Second-order random walk

3.1 Stochastic differential equations

In this report both stochastic ordinary differential equations and stochastic partial dif-ferential equations will be considered. A general stochastic differential equation will beabbreviated SDE and the abbreviation SPDE will be used for stochastic partial differ-ential equation. An example of a SPDE is a form of the stochastic heat equation whichwill be considered in the next chapter

∂u

∂t(x, t) =

∂2u

∂x2(x, t) +W(x, t), (3.1)

where W(x, t) is space-time white noise. For the purpose of this report the white noisewill always be considered to be Gaussian. This equation differs from the correspondingpartial differential equation by the white noise term on the right hand side.

The objective will not be to try to solve equations of this type exactly, but rathercreate a time-space discretization and consider the joint distribution of the solution atthe discretization points. The joint distribution will not necessarily be constructed tobe exactly correct, but rather an approximation which satisfies some Markov conditions,which gives a GMRF with a sparse precision matrix. First an example of an SDE withonly one independent variable will be given in this chapter and then an example of anSPDE in time and one-dimensional space will be considered in the next chapter.

3.2 Second-order random walk as an SDE

The one-dimensional second-order random walk will be used as an example of a stochasticprocesses indexed only by one variable. This process will serve as an example of astochastic process with time dependency, but no spacial dependency.

A second-order random walk will be considered to be a (continuous) solution of theSDE

Δu(t) = σnW (t), (3.2)

13

Page 22: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

14 CHAPTER 3. SECOND-ORDER RANDOM WALK

where Δ is the Laplacian, d2/dt2, σn > 0 is a constant and W (t) is a standard Wienerprocess. This equation is invariant to the addition of a constant or linear trend to thesolution and does not specify a unique solution. However, as will be seen later this willnot pose a problem when it is used only as a prior distribution.

The construction of a GMRF approximation for this equation on an irregular grid isalready considered in [6] for σn = 1. The steps are nearly identical for σn �= 1, thereforeonly a overview which shows the important steps will be given here.

3.2.1 Approximation of the solution

The solution of the SDE given in Equation (3.2) will be approximated on an interval[a, b]. Select n points a = s1 < . . . < sn = b, and let φi be the function which is linearbetween each node and which is 1 at si and 0 at all other sj for j �= i. Further fori = 1, . . . , n− 1 define di = si+1 − si.

A stochastic weak solution in Hn = span(φ1, . . . , φn) ⊂ H = L2[a, b] is then found byrequiring u ∈ Hn and

〈Δu, φi〉L2[a,b]d=⟨σnW , φi

⟩L2[a,b]

i = 1, . . . , n. (3.3)

Let u(t) =∑n

k=1 φk(t)wk ∈ Hn, where wk are Gaussian random weights. Inserting thisinto Equation (3.3) gives n equations which can be represented in matrix form as

Hwd=C1/2z, (3.4)

where H and C are matrices soon to be defined and z is a standard Gaussian multivariaterandom variable. H consists of all inner products

Hi,j = 〈Δφj , φi〉L2[a,b] (3.5)

and C consists of all inner products

Ci,j = σ2n 〈φj , φi〉L2[a,b] (3.6)

These matrices can be found in [6] and are given by

Hi,j =

⎧⎪⎨⎪⎩

1di−1

j = i− 1, 1 < i < n

−( 1di−1

+ 1di) j = i, 1 < i < n

1di

j = i+ 1, 1 < i < n

,

with zero in all other positions and

Ci,j =

⎧⎪⎨⎪⎩

di−1

6 j = i− 1di6 j = i+ 1di−1+di

3 j = i, 1 < i < n

,

Page 23: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

3.3. SMOOTHING OF TIME SERIES BY SECOND-ORDER RANDOM WALK 15

with C1,1 = d1/3, Cn,n = dn−1/3 and zero in all other positions.It can be shown that rank(H) = n − 2 and that the eigenvectors corresponding

to eigenvalues of 0 are e1 = (1, . . . , 1) and e2 = (s1, s2, . . . , sn). This means that Equa-tion (3.4) does not specify any conditions on eT

1 w and eT2 w. The equation can be rewritten

asz

d=C−1/2Hw, (3.7)

where z ∼ Nn(0, In). This equation cannot have any solutions, because C−1/2H issingular. But it can ”nearly” be solved, in the sense that⟨

C−1/2Hw, a⟩

d= 〈z, a〉 ∀a ∈ Col(C−1/2H). (3.8)

In fact, as previously mentioned, Equation (3.7) gives no information about whatshould happen to aTw for a ∈ Null(H), but by choosing Q = HTC−1H these linearcombinations are given unbounded variance and Equation (3.8) holds.

This Q matrix will generally be dense, but as in [6] this matrix will be replaced byQ = σ−2

n HTC−1H, where C is a diagonal matrix with Ci,i =< φi, 1 >L2[a,b]. This makesQ a sparse band matrix.

3.3 Smoothing of time series by second-order random walk

This section will provide an example of one application of the second-order randomwalk, namely smoothing of time series. The smoothing will attempt to reduce randomfluctuations in the observations and extract the important features of the time series.This will be done by postulating a statistical model for the time series and consideringthe posterior distribution conditioned on the observed values.

3.3.1 Model

Let y(t) be a real-valued time series. The first part of the model will dictate how thevalues of y(t) are generated. y(t) will be considered to be the sum of two independentparts, a random fluctuation ε(t), which is Gaussian white noise with constant varianceσ2ε , and a more ”regular” part x(t). That is y(t) = x(t) + ε(t). ”Regular” is here used as

a non-technical term, only to mean that it has no discontinuities and sudden changes invalues.

Let D = {s1 < s2 < . . . < sn} be a discretization of some interval [a, b] and assumethat y(t) is observed on k ≤ n of these points. For convenience denote the vector of x(si)for i = 1, . . . , n by x and the vector of y(sj) for the observed k points by y. Then theconditional distribution is y|x ∼ Nk(Ax, σ2

ε Ik), where A is the k×n matrix selecting thek observed values from x. That is A has exactly one 1 in each row, and each correspondto a location for which y(t) was observed.

The second part of the model is the choice of prior distribution for x. For this purposea second-order random walk process will be used. The prior distribution of x will be theapproximation by GMRF found previously.

Page 24: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

16 CHAPTER 3. SECOND-ORDER RANDOM WALK

From these assumptions one can calculate the posterior distribution of x. From themodel one finds

π(x|y) ∝ π(x)π(y|x)π(x|y) ∝ exp

(−12

(xTQx+ (y −Ax)Tσ−2

ε In(y −Ax)))

π(x|y) ∝ exp(−1

2

(xT(Q+ σ−2

ε ATA)x− 2xTATσ−2ε y

))π(x|y) ∝ exp

(−1

2

(xTQx− 2xTQQ−1ATσ−2

ε y))

,

where Q = Q+σ−2ε ATA. Comparing this to the expansion of (x−μ)TQ(x−μ) one sees

that μ = σ−2ε Q−1ATy.

The final part of the model will be to specify the scale factor for Q. That is the σnfrom Equation (3.2). As was shown in the previous section the σn enters the equationfor Q as a σ−2

n factor. Since no investigation of the effect of changing σn was done in theprevious sections, different values of σn will be compared.

3.3.2 Effect of scale parameter

To measure the effect of changing the scale parameter, σn, a data set was generated inthe following way. Let the interval of interest be [0, 10] and draw 30 points, D = {ti}30i=1,uniformly in this interval to create a discretization. Then calculate y(t)′ = sin(4πt/10)for t ∈ D and create one realization of the time series y(t) = y(t)′+ ε(t) for t ∈ D, whereε(t) is iid Gaussian white noise with variance 0.01.

Figure 3.1 shows the posterior mean for different values of the scale parameter σn.The true underlying regular part of the time series is a sine wave with amplitude 1 and2 periods on the interval [0, 10]. From Figure 3.1(a) one can see that for σn = 0.01 theposterior mean does not follow the true value well. It appears that only the apparentdownward trend shown by the observations is detected. The σn is too low comparedwith the variations of the underlying regular part of the time series. Figure 3.1(c) showsthat σn = 100 gives a posterior mean with a very ”jagged” behavior, which appears topass very close to all observations, except observations at very close time points. Thisseems to indicate that the value of σn is so large that the type of variations observedin the observations are expected. Lastly Figure 3.1(b) shows the posterior mean whenσn = 1. For this value the posterior mean does not follow the data points exactly, but isnot extremely different from the data points either.

This shows that it is important to chose a value for σn that is appropriate based onknowledge of the variation of the regular part of the time series. This example indicatesthat increasing σn allows larger variations in the posterior mean, whereas decreasing σndecreases the allowed variation.

3.3.3 Effect of model variance

The previous section considered the effect of varying σn. The other parameter whichcan be varied is σε. This corresponds to the variance assumed for the white noise in themodel. This section will use the same data set as generated in the previous section.

Page 25: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

3.3. SMOOTHING OF TIME SERIES BY SECOND-ORDER RANDOM WALK 17

●●

●●●

● ●

●●

● ●●

● ●

2 4 6 8

−1.0

−0.5

0.0

0.5

1.0

Smoothing with σn = 0.01

Time

Valu

e

(a) Scaling factor 0.01.

●●

●●●

● ●

●●

● ●●

● ●

2 4 6 8

−1.0

−0.5

0.0

0.5

1.0

Smoothing with σn = 1

Time

Valu

e

(b) Scaling factor 1.

●●

●●●

● ●

●●

● ●●

● ●

2 4 6 8

−1.0

−0.5

0.0

0.5

1.0

Smoothing with σn = 100

Time

Valu

e

(c) Scaling factor 100.

Figure 3.1: Smoothing of sine-wave data with noise, with different scaling of the precisionmatrix for the underlying second-order random walk. The black circles are the observedvalues and the red line is the posterior mean. σε was chosen equal to the true value, 0.10.

Page 26: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

18 CHAPTER 3. SECOND-ORDER RANDOM WALK

Figure 3.2 shows the posterior mean and marginal standard deviations for σε = 0.02,σε = 0.10 and σε = 0.50. The Figure shows that as the σε parameter is increasedthe posterior mean is allowed to pass farther and farther away from the observations.However, in Figure 3.2(c) one can see that for σε = 0.5, the posterior mean lies belowthe observations for many consecutive observations and similarly above the observationsfor many consecutive observations. This does not fit well with the model assumption ofwhite noise. Figure 3.2(a) shows that for σε = 0.02 the posterior mean is forced to passso close to the observations that the posterior mean becomes ”jagged”. For σε = 0.10,which corresponds to setting the model variance equal to the true variance, the behaviorappears better. The posterior mean is not overly ”jagged” and does not appear to breakthe assumption of white noise.

These results indicate that it is important to use a model variance which correspondsto the true random variation in the data set. Because a too low value gives a ”jagged”behavior, but a too large value gives a posterior distribution which appears to break theassumption of white noise.

3.3.4 Example 1: Missing data

As a first example consider again the data in Section 3.3.2, but with different subsets ofdata removed. Figure 3.3 shows the results after removing observations {12, . . . , 21} andafter removing observations {16, . . . , 20}. In Figure 3.3(b) the posterior mean seems tofollow the missing observations well, but in Figure 3.3(a) the posterior mean starts toincrease much earlier than the missing observations. Further one can see that removingobservations seems to increase the marginal variance at the points at which there areno observations, but the variances do not appear to change much for most of the pointswith observations.

3.3.5 Example 2: Square wave with white noise

In this section the following two data sets will be considered. The first was generatedby using a regular grid on [0, 10] with 30 points and evaluating the square wave x(t) =−sgn(sin(4πt/10)) at each point. Then one realization of the time series y1(t) = x(t)+ε(t)was drawn on the grid, where ε(t) was iid Gaussian white noise with constant variance0.01. Then the procedure was repeated with 20000 points in the regular grid.

Figure 3.4 shows the posterior mean based on each of these two data sets. Fig-ure 3.4(a) shows that 30 points give a quite good approximation considering only 30points were used, but as Figure 3.4(b) shows, the posterior mean is not able follow thebehavior of the sudden jump even for 20000 observations. However, this is not unex-pected as the prior is second-order random walk. A realization of a second-order randomwalk will almost surely not be a square-wave, as such the underlying model with a second-order random walk prior is not appropriate for these data sets. This shows that this typeof smoothing can not be expected to capture the exact behavior at discontinuities.

Page 27: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

3.3. SMOOTHING OF TIME SERIES BY SECOND-ORDER RANDOM WALK 19

●●

●●●

●●

● ●

●●

● ●●

● ●

2 4 6 8−1.5

−0.5

0.5

1.0

1.5

Smoothing with σε = 0.02

Time

Valu

e

(a) Model standard deviation 0.02.

●●

●●●

●●

● ●

●●

● ●●

● ●

2 4 6 8−1.5

−0.5

0.5

1.0

1.5

Smoothing with σε = 0.1

Time

Valu

e

(b) Model standard deviation 0.10.

●●

●●●

●●

● ●

●●

● ●●

● ●

2 4 6 8−1.5

−0.5

0.5

1.0

1.5

Smoothing with σε = 0.5

Time

Valu

e

(c) Model standard deviation 0.50.

Figure 3.2: Smoothing of sine-wave data with noise, with use of different values for themodel parameter σε. The black circles are the observed values, the red line is the posteriormean and the green lines are ±1.64 times the marginal standard deviations. σn was setto 1.

Page 28: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

20 CHAPTER 3. SECOND-ORDER RANDOM WALK

●●

●●●●●

●●

●●

●● ●

●●

2 4 6 8

−2−1

01

2

Missing observations

Time

Valu

e

(a) Missing 9 observations.

●●

●●●●●

●●

●●●

●●

●● ●

●●

2 4 6 8

−2−1

01

2

Missing observations

Time

Valu

e

(b) Missing 5 observations.

Figure 3.3: Smoothing of a data set with a sine-wave with white noise. The observationsused are marked with black circles, the observations not used are marked with blacktriangles, the red line indicates the posterior mean and the green lines are ±1.64 timesthe marginal standard deviation. σε = 0.1 and σn = 1.

Page 29: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

3.3. SMOOTHING OF TIME SERIES BY SECOND-ORDER RANDOM WALK 21

●●

●● ● ●

● ●

●●

● ●

● ● ●

●● ●

● ●● ●

0 2 4 6 8 10

−1.0

−0.5

0.0

0.5

1.0

Smoothing with 30 points

Time

Valu

e

(a) 30 observations.

0 2 4 6 8 10

−1.0

−0.5

0.0

0.5

1.0

Smoothing with 20000 points

Time

Valu

e

(b) 20000 observations.

Figure 3.4: Smoothing of two data sets of square-wave data with white noise. The firstwith 30 points, where both the black circles indicating the observations and the red lineindicating the posterior mean are plotted, and the second with 20000 points, where onlythe posterior mean is plotted. σε = 0.1 and σn = 1.

Page 30: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

22 CHAPTER 3. SECOND-ORDER RANDOM WALK

3.3.6 Conclusion

The model considered in these sections requires the assumption that a time series y(t)can be decomposed into a regular part x(t) and a irregular white noise part ε(t) suchthat y(t) = x(t) + ε(t). By using second-order random walk as a prior for x(t) certainassumptions are made about the type of behavior likely to be exhibited by x(t). For ex-ample lack of discontinuity points and so on. As demonstrated in Section 3.3.5 increasingthe number of points at which the time series is observed did not make the smoothedtime series follow the exact behavior at the discontinuities.

Further as demonstrated in Section 3.3.2 and Section 3.3.3 the choice of scale param-eter and model variance is important for the result of the smoothing. Misspecificationcan give a smoothed time series with very ”jagged” behavior or time series which are veryunlikely under the assumption that the observations were generated with white noise.

It is also possible to use this method to make predictions on the behavior at pointswith missing observations. This was done in Section 3.3.4 for a sine-wave with whitenoise.

Page 31: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Chapter 4

Stochastic heat equation

4.1 Finite volume methods

Finite volume methods are useful for creating discretizations of conservative laws of theform

∂tq(x, t) +∇F (x, t) = f(x, t), (4.1)

where ∇ is the spatial divergence operator. This equation relates the change of the sizeq in time to the spatial divergence of the flux F (x, t) and the sink-/source-term f(x, t).

The idea in the finite volume methods is to for a fixed t partition the spatial domaininto cells, such that the cells ”respect” the conservative law, in some sense. The maintool in these methods is the use of the divergence theorem∫

Ek

∇F dV =

∮∂Ek

F · n dσ, (4.2)

where n is the outer normal vector of the surface ∂Ek relative to Ek.For non-stochastic differential equations a quite thorough treament of finite volume

methods can be found in [2]. In this report a finite volume method will be applied to thefollowing form of the stochastic heat equation

∂tu(x, t)−∇ · ∇u(x, t) = σW(x, t), (4.3)

where ∇ = ∂∂x , σ > 0 is a constant and W(x, t) is space-time white noise.

4.2 Stochastic partial differential equation

The following sections will consider the SPDE given in Equation (4.3) on (x, t) ∈ [0, L]×[0, T ], where L > 0 and T > 0 are constants. That is

∂tu(x, t)−∇ · ∇u(x, t) = σW(x, t), (x, t) ∈ [0, L]× [0, T ], (4.4)

where ∇ = ∂∂x , σ > 0 is a constant and W(x, t) is space-time white noise.

23

Page 32: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

24 CHAPTER 4. STOCHASTIC HEAT EQUATION

4.2.1 Boundary conditions

Equation (4.4) does not have a unique solution, an arbitrary solution of

∂tu(x, t)− ∂2

∂x2u(x, t) = 0,

can be added to the solution. This means for example that an arbitrary constant can beadded to the solution.

For the finite volume scheme which follows in the next section there are two thingswhich must be known if the scheme is going to be used for sequential simulation intime. Some starting condition, u(x, 0) for x ∈ [0, L], and an estimate of spatial flux atthe boundaries, ∂

∂xu(0, t) and ∂∂xu(L, t) for t ∈ [0, T ]. But in the same manner as for

the second-order random walk the interest does not lay in direct simulation, but ratherusing the solution as a prior distribution. This means that it is not necessary that thedistribution is proper.

The problem with the initial condition can be solved by using some Gaussian initialcondition for the starting process, u(x, 0) ∼ u0(x) for x ∈ [0, L]. That is for eachdiscretization 0 = x1 < x2 < · · · < xn = L, (u(x1, 0), . . . , u(xn, 0)) has a Gaussiandistribution with precision matrix Qn, where the size of Qn is n×n and the entries onlydepend on the locations of the points. Qn does not need to have rank n.

It is hard to make any definite claims about the effects of different boundary condi-tions, therefore the next section will present the finite volume method on Equation (4.4)with the Neumann boundary conditions

∂xu(0, t) = 0 t ∈ [0, T ]

∂xu(L, t) = 0 t ∈ [0, T ],

and an arbitrary Gaussian initial distribution with mean zero.

4.2.2 Approximation by a finite volume method

Consider Equation (4.4) with Neumann boundary conditions ∂∂xu(0, t) = 0 and ∂

∂xu(L, t) =0 for t ∈ [0, T ]. In addition to u(x, 0) ∼ u0(x) for x ∈ [0, L], where u0(x) is a Gaussianrandom field with mean zero.

Begin by choosing a spatial grid 0 = s1 < · · · < sN = L. Define di = si+1 − si fori = 1, . . . , N − 1. Continue by dividing [0, L] into cells, by letting E1 = [s1, s1 + d1/2],EN = [sN−dN−1/2, sN ] and Ei = [si−di−1/2, si+di/2] for i = 2, . . . , N−1. Observe thatthe cells fulfill the properties, ∪n

i=1Ei = [0, L] and Ei ∩ Ej = ∅ for i �= j. Further let Vi

denote the length of interval Ei for i = 1, . . . , N . For ease of notation let si+1/2 = si+di/2for i = 1, . . . , N−1, s1/2 = s1 and sN+1/2 = sN . Further let 0 = t0 < t1 < · · · < tM = T ,be a regular grid in time and let k = t1 − t0.

Page 33: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

4.2. STOCHASTIC PARTIAL DIFFERENTIAL EQUATION 25

Start by integrating Equation (4.4) over one time step, tm to tm+1, and one cell, En,this gives∫

En

∫ tm+1

tm

∂tu dt dx−

∫ tm+1

tm

∫En

∇ · ∇u dx dt = σ

∫ tm+1

tm

∫En

W dx dt.

By using the divergence theorem given in Equation (4.2) this can be written as∫En

(u(x, tm+1)− u(x, tm)) dx−∫ tm+1

tm

(∂

∂xu(sn+1/2, t)−

∂xu(sn−1/2, t)

)dt =

=√kVnσz

m+1n ,

(4.5)

where zm+1n is a standard Gaussian random variable. No approximations have been made

yet, but to continue from this point it is necessary to approximate both the terms on theleft hand side of the equation.

First consider the first integral in Equation (4.5). For simplicity assume u(x, tm) =Umn for all x ∈ En, that is for a fixed tm, the solution u is constant on each cell. This

means in some sense that the value of u(sn, tm) is approximated by the mean of the cell.This gives ∫

En

(u(x, tm+1)− u(x, tm)) dx = Vn(Um+1n − Um

n ).

Secondly consider the flux terms ∂∂xu(sn+1/2, t) at the boundaries of each cell. The

following simple first order approximation will be used for the the flux at the internalboundaries, i.e. between two cells,

∂xu(sn+1/2, t) =

u(sn+1, t)− u(sn, t)

dn, n = 1, . . . , N − 1.

Lastly the second integral in Equation (4.5) must be considered. The integral cannotbe solved analytically, therefore a time discretization scheme must be used. Here theimplicit Euler method will be used, this gives∫ tm+1

tm

(∂

∂xu(sn+1/2, t)−

∂xu(sn−1/2, t)

)dt =

= k

(∂

∂xu(sn+1/2, tm+1)− ∂

∂xu(sn−1/2, tm+1)

).

Inserting all these approximations into Equation (4.5) and considering an internalcell, that is n ∈ {2, . . . , N − 1}, gives

Vn(Um+1n − Um

n )− k

(Um+1n+1 − Um+1

n

dn− Um+1

n − Um+1n−1

dn−1

)=√

kVnσzm+1n . (4.6)

For the exterior cells the Neumann boundary conditions

∂xu(s1/2, t) = 0

Page 34: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

26 CHAPTER 4. STOCHASTIC HEAT EQUATION

and∂

∂xu(sN+1/2, t) = 0,

will be used, that is zero flux at the boundaries. Using this the discretization at theboundary cells can be written as

V1(Um+11 − Um

1 )− kUm+12 − Um+1

1

d1=√

kV1σzm+11

and

Vn(Um+1n − Um

n ) + kUm+1n − Um+1

n−1

dn=√

kVNσzm+1N .

The scheme can be written in matrix form as

D(Um+1 − Um)− kHUm+1 =√kD1/2σZm+1, (4.7)

where D = diag(V1, . . . , VN ), Zm+1 ∼ NN (0, IN ), Um = (Um1 , . . . , Um

N ) and H is a matrixwith

Hi,j =

⎧⎪⎪⎪⎪⎪⎪⎪⎪⎪⎨⎪⎪⎪⎪⎪⎪⎪⎪⎪⎩

− 1d1

i = j = 1

−( 1di−1

+ 1di) 1 < i = j < N

− 1dn−1

i = j = N1di

j = i+ 11dj

j = i− 1

0 otherwise

.

Equation (4.7) can be rewritten as

Zm+1 =1√kσ

D−1/2((D − kH)Um+1 −DUm

). (4.8)

In this form one can consider the joint distribution of Z1, . . . , ZM , which are independent,and find the joint distribution of U0, . . . , UM . By assumptions U0 has some Gaussiandistribution with precision matrix A ≥ 0 and the joint distribution of U0, . . . , UM canbe found by

π(U0, . . . , UM ) ∝ π(U0)π(Z1, . . . , ZM |U0) ∝

∝ exp

(−1

2

((U0)TAU0 + ZT

1 Z1 + . . .+ ZTMZM

)).

From this one can deduce that the precision matrix, Q, of U =((U0)T, . . . , (UM )T

)is a N(M + 1) × N(M + 1) block tridiagonal matrix with blocks of size N × N . LetB = D − kH, then Q can be written as

Q =1

σ2k

⎡⎢⎢⎢⎢⎢⎢⎣

D +Aσ2k −B 0 · · · 0−BT D +BTD−1B −B 0

0. . . . . . . . .

...... −BT D +BTD−1B −B0 · · · 0 −BT BTD−1B

⎤⎥⎥⎥⎥⎥⎥⎦. (4.9)

Page 35: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

4.3. PROPERTIES OF THE APPROXIMATION 27

4.3 Properties of the approximation

4.3.1 The precision matrix

Let Q be the precision matrix in Equation (4.9), with N nodes in the spatial grid andM+1 nodes in the time grid. The following lemma will help find the rank and null spaceof Q.

Lemma 4.3.1. Let u : RN → RN(M+1) be given by

u(a) =(aT, (B−1Da)T, . . . , ((B−1D)Ma)T

),

where B and D are as in Section 4.2.2.Then u is a linear injection, and {u(a1), u(a2), . . . , u(al)} is a set of linear independent

vectors iff {a1, a2 . . . , al} is a set of linearly independent vectors.

Proof. The linearity follows from the fact that

u(a) = Ma,

where M is the block diagonal matrix given by M = diag(IN , B−1D, . . . , (B−1D)M ).Observe that u(0) = 0 and that if u(a) is divided into M + 1 blocks of size N , then

the first block of u(a) is equal to a. This means that u(a) = 0 iff a = 0, i.e. u is injective.The linear independence follows from the one-to-one property and the linearity of u,

sincec1u(a1) + c2u(a2) + . . .+ clu(al) = u(c1a1 + c2a2 + . . .+ clal) = 0

iffc1a1 + c2a2 + . . .+ clal = 0.

This implies that {u(a1), u(a2), . . . , u(al)} is a set of linearly independent vectors iff{a1, a2, . . . , al} is a set of linearly independent vectors

The function u defined in Lemma 4.3.1 corresponds to the evolution of the meanusing the discretization scheme from the previous section. Let μk = E(Uk), and takethe expected value on both sides of Equation (4.7), then u(μ0) = (μT

0 , μT1 , . . . , μ

TM ). The

following proposition shows that this function is closely connected to the eigenvectors ofQ.

Proposition 4.3.2. Let Q be the precision matrix found in Section 4.2.2, with sizeN(M +1)×N(M +1) and N ×N size blocks, and let u : RN → R

N(M+1) be the functiongiven in Lemma 4.3.1.

Then Null(Q) = {u(a) : Aa = 0, a ∈ RN} and the nullity of Q is equal to the nullity

of A.

Page 36: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

28 CHAPTER 4. STOCHASTIC HEAT EQUATION

Proof. Let x ∈ RN(M+1) and divide x into M + 1 blocks of size N .

Qx = 0 iff each block of Qx is zero. The last block is 0 iff

−BTxM−1 +BTD−1BxM = 0,

which is true iff xM = B−1DxM−1. This is true since B is strictly diagonally dominantfor all time step sizes and therefore always invertible. Assume xl = D−1Bxl−1 for a fixedl ∈ {M, . . . , 2}. Then block l of Qx is 0 iff

0 = −BTxl−2 + (D +BTD−1B)xl−1 −Bxl =

= −BTxl−2 + (D +BTD−1B)xl−1 −BB−1Dxl−1,

which is true iff xl−1 = B−1Dxl−2. Thus by mathematical induction the last M blocksof Qx is equal to 0 iff xl = B−1Dxl−1 for l = M, . . . , 1.

This means that any x such that Qx = 0 must be on the form x = u(a) for somea ∈ R

N . But if this is true Qx = 0 iff the first block of Qx is equal to zero, that is

(D +Akσ2)a−BB−1Da = Aa = 0.

Therefore Qx = 0 iff x = u(a) for an a ∈ RN such that Aa = 0. Thus the null space of

Q is given byNull(Q) = {u(a) : Aa = 0, a ∈ R

N} ⊂ RN(M+1).

From Lemma 4.3.1 the function u is a injective linear transformation. This meansthat the dimension of {u(a) : Aa = 0, a ∈ R

N} is equal to the dimension of {a : Aa =0, a ∈ R

N} and the nullity of Q and A are the same.

The proposition shows that rank(Q) = NM + rank(A). Let j = (1, . . . , 1) ∈ RN ,

then D−1Bj = j, since j is in the null space of H, which means that j = B−1Dj. Thusit follows that (1, . . . , 1) ∈ R

N(M+1) is in the null space of Q iff j is in the null space ofA.

4.3.2 Total energy

For the purpose of this section call∫ L0 u(x, t) dx the total energy or total amount of u

at time t. This section will show the relationship between the total energy according toEquation (4.4) and the discretization scheme.

From Equation (4.4) one has∫ L

0

∫ t1

t0

∂su(x, s) ds dx =

∫ L

0

∫ t1

t0

(∂2

∂x2u(x, s) + σW(x, s)

)ds dx,

for 0 ≤ t0 ≤ t1 ≤ T . From the divergence theorem in Equation (4.2) this can be writtenas∫ L

0(u(x, t1)− u(x, t0)) dx =

∫ t1

t0

(∂

∂xu(L, s)− ∂

∂xu(0, s)

)ds+ σ

√L(W (t1)−W (t0)),

Page 37: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

4.3. PROPERTIES OF THE APPROXIMATION 29

where W (t) is a standard Wiener process. Using the Neumann boundary conditions thisbecomes ∫ L

0u(x, t1) dx =

∫ L

0u(x, t0) dx+ σ

√L(W (t1)−W (t0)).

This means that∫ L

0u(x, t) dx = σ

√LW (t) +

∫ L

0u(x, 0) dx, 0 ≤ t ≤ T.

This gives ∫ L

0u(x, t) dx−

∫ L

0u(x, 0) dx = σ

√LW (t). (4.10)

Let 0 = t0 < t1 < · · · < tM = T be a regular grid in time and 0 = s1 < · · · < sN = La grid in space. Let k = t1 − t0 and let B = D − kH as in Section 4.2.2, then B isalways invertible. Let Um

n be the approximate solution of u(sn, tm) and denote Um =(Um

1 , . . . , UmN ). Let u(x, tm) be equal to Um

n for x ∈ En, that is constant on each cell foreach time. Then for the approximate solution

∫ L

0u(x, tm) dx = jTDUm,

where j = (1, . . . , 1) ∈ RN .

First observe thatjTBD−1 = jT(IN − kHD−1) = jT

since jTH = 0. This means that

jT = jTDB−1,

which in turn givesjTD = jTDB−1D. (4.11)

Using Equation (4.7) one has

Um+1 = B−1D(Um + σ√kD−1/2Zm+1),

which gives

jTDUm+1 = jTDB−1D(Um+σ√kD−1/2Zm+1) = jTD(Um+σ

√kD−1/2Zm+1). (4.12)

Define Rm = jTDUm and observe that

Var(σ√kjTD1/2Zm+1) = σ2kjTDj = σ2kL.

This means that

Rm+1 = Rm + σ√kLzm+1, m = 0, . . . ,M − 1,

Page 38: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

30 CHAPTER 4. STOCHASTIC HEAT EQUATION

where z1, . . . , zM are iid standard Gaussian variables. Thus it can be written in the form∫ L

0u(x, tm) dx−

∫ L

0u(x, 0) dx = σ

√LW (tm), (4.13)

where W (t) is a standard Wiener process.Observe further that in Equation (4.10)

W (t) =

∫ t

0

∫ L

0W(x, t) dx dt

and that from Equation (4.5) and Equation (4.12)

W (tm) =m∑i=1

√kjTD1/2Zi

=m∑i=1

√k

N∑j=1

√Vjz

ij

=m∑i=1

N∑j=1

√k√

Vj1√Vjk

∫ ti

ti−1

∫Ej

W(x, t) dx dt

=m∑i=1

N∑j=1

∫ ti

ti−1

∫Ej

W(x, t) dx dt

=

∫ tm

0

∫ L

0W(x, t) dx dt = W (tm)

This means that Equation (4.13) gives the discrete equivalent of Equation (4.10).Let the approximate solution be constant on each cell and use the initial conditionu(x, 0)

d=u0(x) and u(x, 0) ∼ u0(x) for x ∈ [0, L], then∫ L

0u(x, tm) dx−

∫ L

0u(x, tm) dx =

∫ L

0(u(x, 0)− u(x, 0)) dx, m = 0, . . . ,M,

If the initial conditions are chosen as U0n equal to the mean of u0(x) in cell En, then∫ L

0u(x, tm) dx

d=

∫ L

0u(x, tm) dx, m = 0, . . . ,M.

This means that for this choice of distribution for U0 the discretization scheme gives thecorrect distribution for the total energy of u at the time steps t0, . . . , tM . Further if

E

[∣∣∣∣∫ L

0u(x, t0) dx−

∫ L

0u(x, t0)

∣∣∣∣2]= C �= 0,

then the mean square error between the total energy of the true solution and the dis-cretization scheme is the same for all time steps independent of the number of time stepsused.

Page 39: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

4.4. EXAMPLES 31

4.3.3 Initial condition

As shown in Proposition 4.3.2 the precision matrix has the same nullity as A. This meansthat a diffuse prior for U0 gives a nullity of N and it can be hard to make the distributionproper when conditioning on variables. Therefore this is not a good strategy unless onecondition on U0, with hard or soft constraints.

Another choice is to use a discretization of some known stochastic process u0(x). Forexample the second order random walk studied in Chapter 3. This choice gives the totalprecision matrix a nullity of 2. In a strict sense this is not allowed unless one conditionsthe second-order random walk on zero derivative for x = 0 and x = L, but this will beignored.

4.4 Examples

4.4.1 Second-order random walk as initial condition

Consider the stochastic heat equation on (x, t) ∈ [0, 5]× [0, 10] with the Neumann bound-ary conditions ∂

∂xu(0, t) = ∂∂xu(5, t) = 0 for t ∈ [0, 10] with σ = 1. Under the initial

condition u(x, 0) is a second-order random walk with σn = 1.Let 0 = x1 < · · · < x100 = 5 be a regular spatial grid and 0 = t0 · · · < t399 = 10 be a

regular time grid. Let Umn = u(xn, tm) and use the precision matrix found in Section 4.2.2

with σ = 1 and A equal to the precision matrix found in the section for second-orderrandom walk with σn = 1. This gives 40000 variables.

By Proposition 4.3.2 this gives a precision matrix with nullity 2, so it is necessaryto condition on some variables, either with soft or with hard constraints. To simplifysimulation assume the values were measured with Gaussian iid errors with standarddeviation 0.00001

u(x10, t0) = U010 = 10,

u(x90, t1) = U190 = 8,

u(x80, t50) = U5080 = 8,

u(x40, t200) = U20040 = 7,

u(x20, t350) = U35020 = 9,

u(x60, t390) = U39060 = 4.

Figure 4.1(a) shows the marginal variances of the conditional distribution. As ex-pected the variances at the observed points are close to zero, but it appears that thevariance increases more slowly in the spacial direction than in the temporal directionnear each of the observed point.

Figure 4.1(b) shows the mean of the conditional distribution. It appears that thedifferences in the mean in space for a given time equalizes in a couple of time units forthis distribution between observations. This is connected with the ratio between theconstant in front of the ∂

∂tu(x, t) term and the constant in front of the ∂2

∂x2u(x, t) term in

Page 40: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

32 CHAPTER 4. STOCHASTIC HEAT EQUATION

Time

Pos

ition

Marginal variances

0 2 4 6 8 100

1

2

3

4

5

0.2

0.4

0.6

0.8

1

(a) Marginal variances.

Time

Pos

ition

Mean values

0 2 4 6 8 100

1

2

3

4

5

4

6

8

10

(b) Mean values.

Figure 4.1: Mean values and marginal variances as a function of time and position forthe conditional distribution with σ = 1 in the stochastic heat equation and σn = 1 inthe second-order random walk initial condition.

Equation (4.4). In this distribution the ratio is one since a factor of one is used for bothterms, but decreasing the factor in front of the ∂2

∂x2u(x, t) term relative to the factor infront of the ∂

∂tu(x, t) term would decrease the spatial flux, relative to the time scale, andincrease the time it would take for the mean to stabilize.

Figure 4.2(a) and Figure 4.2(b) shows two different realizations from the conditionaldistribution as functions of time and space. The figures show that the realizations fromthe conditional distribution do not appear to look like ”smoothly” changing functions oftime and space. The realizations look noisy.

Page 41: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

4.4. EXAMPLES 33

Time

Pos

ition

Realisation from conditional distribution

0 2 4 6 8 100

1

2

3

4

5

4

6

8

10

(a) A realization from the conditional distribution.

Time

Pos

ition

Realisation from conditional distribution

0 2 4 6 8 100

1

2

3

4

5

4

6

8

10

(b) A realization from the conditional distribution.

Figure 4.2: Two realizations as a function of time and position from the conditionaldistribution with σ = 1 in the stochastic heat equation and σn = 1 in the second-orderrandom walk initial condition.

Page 42: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

34 CHAPTER 4. STOCHASTIC HEAT EQUATION

4.4.2 Fixed initial condition

A 100×400 grid was constructed in the same way as in Section 4.4.1, with Umn = u(xn, tn)

and the initial condition

u0(x) =

{10 0 ≤ x < 5

2

−10 52 ≤ x ≤ 5

. (4.14)

Since the initial condition specifies exact values for U0, the specification of A isirrelevant. This is because only the conditional distribution π(U1, . . . , UM |U0) is needed.To make it easy to use the model in the same fashion as in the previous example A = 0will be used and the distribution will be conditioned on observed U0

n+εn for n = 1, . . . , N ,where εn are iid Gaussian with mean 0 and standard deviation 0.00001. That is the valuesare observed nearly exact.

Figure 4.3(a) shows the marginal variances of the conditional distribution. The vari-ances start at zero at time zero and then increases with time. The variances appear toincrease most quickly at the edges and more slowly in the middle of the spatial domain.

Figure 4.3(b) shows the the mean of the conditional distribution. Since an exact initialcondition was used, this corresponds to the solution of the non-stochastic differentialequation

∂tu(x, t) =

∂2

∂x2u(x, t),

with the Neumann boundary condition previously specified. This equation is a conser-vative law and many properties of this equation is known. It corresponds to a diffusionwhere no ”mass” can leave the boundaries. The solution will stabilize to a constant levelin space. The equation only redistributes the ”mass” to a constant level in space.

Figure 4.4(a) and Figure 4.4(b) shows two different realizations from the conditionaldistribution as functions of time and space. These realizations illustrate that as the timeincreases the mean of the variables tends to zero, and that there is a balance betweenrandom fluctuations and equalization of nearby values.

4.5 Conclusion

Section 4.2.2 shows that the finite volume method can be used to construct a GMRFapproximation to the discretized solution of one form of the stochastic heat equation.

Section 4.3.2 shows that the discretization scheme created by the finite volume methodgives the correct distribution of the total ”energy” of the solution at each time, that is theintegral of the solution over the spatial domain, when it is used to sequentially simulatethe solution from a fixed initial condition.

The discretization scheme appears to give good results for a fixed initial state, asdemonstrated in Section 4.4.2, and for one special case where the initial condition issecond-order random walk, as demonstrated in Section 4.4.1. The example with second-order random walk also shows that the conditional distribution has reasonable propertieswhen one conditions on values at some locations in time and space. The variances arelower around the observed values and the mean passes through the observed values.

Page 43: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

4.5. CONCLUSION 35

Time

Pos

ition

Marginal variances

0 2 4 6 8 100

1

2

3

4

5

0.5

1

1.5

2

2.5

(a) Marginal variances.

Time

Pos

ition

Mean values

0 2 4 6 8 100

1

2

3

4

5

−10

−5

0

5

10

(b) Mean values.

Figure 4.3: Mean values and marginal variances as a function of time and position forthe conditional distribution with σ = 1 in the stochastic heat equation and the initialcondition specified in Equation (4.14).

Page 44: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

36 CHAPTER 4. STOCHASTIC HEAT EQUATION

Time

Pos

ition

Realisation from conditional distribution

0 2 4 6 8 100

1

2

3

4

5

−10

−5

0

5

10

(a) A realization from the conditional distribution.

Time

Pos

ition

Realisation from conditional distribution

0 2 4 6 8 100

1

2

3

4

5

−10

−5

0

5

10

(b) A realization from the conditional distribution.

Figure 4.4: Mean values and marginal variances as a function of time and position forthe conditional distribution with σ = 1 in the stochastic heat equation and the initialcondition specified in Equation (4.14).

Page 45: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

4.5. CONCLUSION 37

The time discretization by an implicit Euler scheme appears to give good results forthe joint distribution when the SPDE in Equation (4.4) is solved with the Neumannboundary conditions of zero flux at the spatial boundaries for all times.

Page 46: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

38 CHAPTER 4. STOCHASTIC HEAT EQUATION

Page 47: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Chapter 5

Conclusion

The use of Gaussian Markov random field approximations for the solution of stochasticpartial differential equation gives joint distributions with sparse precision matrices. Thesekinds of distributions can be handled well by numerical tools for sparse matrices. Thismeans that such operations as simulations and calculation of marginal variances can bedone more efficiently than when using the true precision matrix, or the covariance matrixof the solution which often will be dense.

The construction of the approximation as a Gaussian multivariate distribution meansthat the solutions can be used easily as a part of a greater model, for example the use ofsecond-order random walk as a prior model when smoothing time-series.

This report shows that this type of construction is also possible for non-stationarystochastic partial differential equations, by the use of a spatial discretization to create asystem of stochastic differential equations only in time and solving this system by a timediscretization. This type of construction shows good results and merits further study.

39

Page 48: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

40 CHAPTER 5. CONCLUSION

Page 49: Approximating Solutions of Stochastic Differential Equations with Gaussian … · 2016-03-11 · Approximating Solutions of Stochastic Differential Equations with Gaussian Markov

Bibliography

[1] Yanqing Chen, Timothy A. Davis, William W. Hager, and Sivasankaran Rajaman-ickam. Algorithm 887: Cholmod, supernodal sparse cholesky factorization and up-date/downdate. ACM Trans. Math. Softw., 35(3):1–14, 2008.

[2] R. Eymard, T. Gallouët, and R. Herbin. Finite volume methods. Handbook of nu-merical analysis, 7:713–1018, 2000.

[3] A.E. Gelfand, M. Fuentes, P. Diggle, and P. Guttorp. Handbook of spatial statistics.CRC, 2010.

[4] Gaël Guennebaud, Benoît Jacob, et al. Eigen v3. http://eigen.tuxfamily.org, 2010.

[5] F. Lindgren, J. Lindström, and H. Rue. An explicit link between Gaussian fields andGaussian Markov random fields: The SPDE approach. Preprint Statistics, 5, 2010.

[6] F. Lindgren and H. Rue. On the Second-Order Random Walk Model for IrregularLocations. Scandinavian journal of statistics, 35(4):691–700, 2008.

[7] H. Rue and L. Held. Gaussian Markov random fields: theory and applications. Chap-man & Hall, 2005.

41