-
Notifications
You must be signed in to change notification settings - Fork 8
/
sim.rf.html
129 lines (102 loc) · 4.37 KB
/
sim.rf.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Simulates a Stationary Gaussian random field</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>
<table width="100%" summary="page for sim.rf {fields}"><tr><td>sim.rf {fields}</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>
Simulates a Stationary Gaussian random field
</h2>
<h3>Description</h3>
<p>Simulates a stationary Gaussian random field on a regular grid with
unit marginal variance.
</p>
<h3>Usage</h3>
<pre>
sim.rf(obj)
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>obj</code></td>
<td>
<p>A covariance object that includes information about the covariance
function and the grid for evaluation. Usually this is created by a
setup call to Exp.image.cov, stationary.image.cov, matern.image.cov or
other related covariance functions. (See details below.)
</p>
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
<p>Additional arguments passed to a particular method.</p>
</td></tr>
</table>
<h3>Details</h3>
<p>The simulated field has the marginal variance that is determined by
the covariance function for zero distance. Within fields the
exponential and matern set this equal to one ( e.g. Matern(0) ==1) so
that one simulates a random field with a marginal variance of one. For
stationary.cov the marginal variance is <code>cov.function(0)</code> and we
recommend that alternative covariance functions also be normalized so
that this is one.
</p>
<p>Of course if one requires a Gaussian field with different marginal
variance one can simply scale the result of this function. See the
third example below.
</p>
<p>This function takes an object that includes some preliminary
calculations and so is more efficient for simulating more than one
field from the same covariance. However, the algorithm using a 2-d FFT
(known as circulant embedding) may not always work if the correlation
range is large. The simple fix is to increase the size of the domain
so that the correlation scale becomes smaller relative to the extent
of the domain. Increasing the size can be computationally expensive
however and so this method has some limitations. But when it works it is
and exact simulation of the random field.
</p>
<p>For a stationary model the covariance object should have the components:
</p>
<p>names( obj)
"m" "n" "grid" "N" "M" "wght",
</p>
<p>where m and n are the number of grid points in x and y, grid is a list
with components x and y giving the grid points in each coordinate. N
and M is the size of the larger grid that is used for
simulation. Usually M = 2*m and N =2*n and results in an exact
simulation of the stationary Gaussian field. wght is a matrix from
the FFT of the covariance function. The easiest way to create this
object is to use for example Exp.image.cov with setup=T ( see below).
</p>
<p>The classic reference for this algorithm is
Wood, A.T.A. and Chan, G. (1994).
Simulation of Stationary Gaussian Processes in [0,1]^d . Journal of
Computational and Graphical Statistics, 3, 409-432. Micheal Stein and
Tilman Gneiting have also made some additional contributions to the
algortihms and theory.
</p>
<h3>Value</h3>
<p>A matrix with the random field values
</p>
<h3>See Also</h3>
<p>Exp.image.cov, matern.image.cov, stationary.image.cov
</p>
<h3>Examples</h3>
<pre>
#Simulate a Gaussian random field with an exponential covariance function,
#range parameter = 2.0 and the domain is [0,5]X [0,5] evaluating the
#field at a 100X100 grid.
grid<- list( x= seq( 0,5,,100), y= seq(0,5,,100))
obj<-Exp.image.cov( grid=grid, theta=.5, setup=TRUE)
look<- sim.rf( obj)
# Now simulate another ...
look2<- sim.rf( obj)
# Suppose one requires an exponential, range = 2
# but marginal variance = 10 ( rho in fields notation)
look3<- sqrt( 10)* sim.rf( obj)
# take a look at first two
set.panel(2,1)
image.plot( grid$x, grid$y, look)
title("simulated gaussian fields")
image.plot( grid$x, grid$y, look2)
title("another realization ...")
</pre>
<hr /><div style="text-align: center;">[Package <em>fields</em> version 9.9 <a href="00Index.html">Index</a>]</div>
</body></html>