Description Usage Arguments Details Examples
View source: R/generateMTSFast.r
For more details see section 6 in Serinaldi and Kilsby (2018), and section 2.4 in Papalexiou and Serinaldi (2020)
1 2 3 4 5 6 7 8 9 10 11 12 | generateMTSFast(
n,
spacepoints,
margdist,
margarg,
p0,
distbounds = c(-Inf, Inf),
stcsid,
stcsarg,
scalefactor = 1,
anisotropyarg = list(phi1 = 1, phi2 = 1, theta = 0)
)
|
n |
number of fields (time steps) to simulate |
spacepoints |
matrix (d x 2) of coordinates (e.g. longitude and latitude) of d spatial locations (e.g. d gauge stations) |
margdist |
target marginal distribution of the field |
margarg |
list of marginal distribution arguments |
p0 |
probability zero |
distbounds |
distribution bounds (default set to c(-Inf, Inf)) |
stcsid |
spatiotemporal correlation structure ID |
stcsarg |
list of spatiotemporal correlation structure arguments |
scalefactor |
factor specifying the distance between the centers of two pixels (default set to 1) |
anisotropyarg |
list of arguments establishing spatial anisotropy. phi1 and phi2 control the stretch in two orthogonal directions (e.g., longitude and latitude) while the angle theta controls a counterclockwise rotation (default set to list(phi1 = 1, phi2 = 1 , theta = 0) for isotropic fields) |
generateMTSFast
provides a faster approach to multivariate simulation
compared to generateMTS
by exploiting circulant embedding
fast Fourier transformation.
However, this approach is feasible only for approximately
separable target spatiotemporal correlation functions (see section 6 in
Serinaldi and Kilsby (2018)).
generateMTSFast
comprises fitting and simulation in a single function.
Here, we give indicative CPU times for some settings, referring to a
Windows 10 Pro x64 laptop with Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz,
4-core, 8 logical processors, and 32GB RAM.
CPU time:
d = 2500, n = 1000: ~58s
d = 2500, n = 10000: ~160s
d = 10000, n = 1000: ~2955s (~50min)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | coord <- cbind(runif(4)*30, runif(4)*30)
sim <- generateMTSFast(
n = 50,
spacepoints = coord,
p0 = 0.7,
margdist ='paretoII',
margarg = list(scale = 1,
shape = .3),
stcsarg = list(scfid = "weibull",
tcfid = "weibull",
scfarg = list(scale = 20,
shape = 0.7),
tcfarg = list(scale = 1.1,
shape = 0.8))
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.