[R-sig-Geo] Problems with CondSimu() in RandomFields 2.0.59
Katharina Henneböhl
khenn_02 at uni-muenster.de
Thu Jan 31 12:28:25 CET 2013
Dear R-sig-geo list,
I am using the CondSimu() function in RandomFields for performance tests on
conditional simulation - in particular the circulant embedding method.
Unfortunately I am getting strange results when using the current RandomFields
version 2.0.59. The code is attached below. I have tested it on Windows 7 (R
2.15.2) and Ubuntu 12.04 (R 2.15.1).
The first realization seems OK, all subsequent realizations not. Has anybody
an idea what is going wrong?
The code produces valid simulations when using RandomFields version 1.3.47
(Feb 2011).
Thanks and best wishes,
Katharina Henneböhl
Institute for Geoinformatics (ifgi)
University of Muenster
Weseler Str. 253
48151 Münster
Germany
# RandomFields 2.0.59
library(RandomFields)
m = 100 # simulation grid 100 x 100
n = 144 # number of data points
# covariance model, assume mean 0, var 1, nugget 0, range 10)
param <- c(0, 1, 0, 10)
model <- "exponential"
# simulation locations
x <- seq(1, m, by=1)
y <- seq(1, m, by=1)
# some gridded data locations, gridded is required for circulant embedding
xdata = c(8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96)
ydata = c(8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96)
given = expand.grid(xdata, ydata)
# (uncorrelated) dummy data
data <- rnorm(n)
# an extreme data value that we can 'see' in the plot
data[15]=10 # location in data grid row 24 and column 16
# conditioning using simple kriging
krige.method <- "S"
# generating 50 conditional simulations
cz <- CondSimu(krige.method, x, y, n=50, given=given,method="circulant
embedding", grid=TRUE, model=model, param=param,data=data)
# the first realization seems correct
image(cz[,,1])
cz[,,1][24,16] # extreme data point
# the 2nd realization not
image(cz[,,2])
cz[,,2][24,16] # extreme data point
# the 10th realization not
image(cz[,,10])
cz[,,10][24,16] # extreme data point
More information about the R-sig-Geo
mailing list