fitVAR {CoSMoS} | R Documentation |
VAR model parameters to simulate correlated parent Gaussian random vectors and fields
Description
Compute VAR model parameters to simulate parent Gaussian random vectors with specified spatiotemporal correlation structure using the method described by Biller and Nelson (2003).
Usage
fitVAR(
spacepoints,
p,
margdist,
margarg,
p0,
distbounds = c(-Inf, Inf),
stcsid,
stcsarg,
scalefactor = 1,
anisotropyid = "affine",
anisotropyarg = list(phi1 = 1, phi2 = 1, phi12 = 0, theta = 0),
advectionid = "uniform",
advectionarg = list(u = 0, v = 0)
)
Arguments
spacepoints |
it can be a numeric integer, which is interpreted as the side length m of the square field (m x m), or a matrix (d x 2) of coordinates (e.g. longitude and latitude) of d spatial locations (e.g. d gauge stations) |
p |
order of VAR(p) model |
margdist |
target marginal distribution of the field |
margarg |
list of marginal distribution arguments. Please consult the documentation of the selected marginal distribution indicated in the argument |
p0 |
probability zero |
distbounds |
distribution bounds (default set to |
stcsid |
spatiotemporal correlation structure ID |
stcsarg |
list of spatiotemporal correlation structure arguments. Please consult the documentation of the selected spatiotemporal correlation structure indicated in the argument |
scalefactor |
factor specifying the distance between the centers of two pixels (default set to 1) |
anisotropyid |
spatial anisotropy ID ( |
anisotropyarg |
list of arguments characterizing the spatial anisotropy according to the syntax of the function |
advectionid |
advection field ID ( |
advectionarg |
list of arguments characterizing the advection field according to the syntax of the function |
Details
The fitting algorithm has O(m*m)^3
complexity for a (m*m)
field
or equivalently O(d^3)
complexity for a d
-dimensional vector.
Very large values of (m*m)
(or d
) and high order AR correlation
structures can be unpractical on standard machines.
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 = 100 or m = 10, p = 1: ~ 0.4s
d = 900 or m = 30, p = 1: ~ 6.0s
d = 900 or m = 30, p = 5: ~ 47.0s
d = 2500 or m = 50, p = 1: ~100.0s
Note
While all the advection types can be applied to isotropic random fields,
anisotropic random fields require more care. We suggest combining affine
anysotropy with uniform
advection, and swirl
anisotropy
with rotation
or spiral
advection with the same rotation center.
References
Biller, B., Nelson, B.L. (2003). Modeling and generating multivariate time-series input processes using a vector autoregressive technique. ACM Trans. Model. Comput. Simul. 13(3), 211-237, doi: 10.1145/937332.937333
Papalexiou, S.M. (2018). Unified theory for stochastic modelling of hydroclimatic processes: Preserving marginal distributions, correlation structures, and intermittency. Advances in Water Resources, 115, 234-252, doi: 10.1016/j.advwatres.2018.02.013
Papalexiou, S.M., Serinaldi, F. (2020). Random Fields Simplified: Preserving Marginal Distributions, Correlations, and Intermittency, With Applications From Rainfall to Humidity. Water Resources Research, 56(2), e2019WR026331, doi: 10.1029/2019WR026331
Papalexiou, S.M., Serinaldi, F., Porcu, E. (2021). Advancing Space-Time Simulation of Random Fields: From Storms to Cyclones and Beyond. Water Resources Research, 57, e2020WR029466, doi: 10.1029/2020WR029466
Examples
## for multivariate simulation
coord <- cbind(runif(4)*30, runif(4)*30)
fit <- fitVAR(
spacepoints = coord,
p = 1,
margdist ='burrXII',
margarg = list(scale = 3,
shape1 = .9,
shape2 = .2),
p0 = 0.8,
stcsid = "clayton",
stcsarg = list(scfid = "weibull",
tcfid = "weibull",
copulaarg = 2,
scfarg = list(scale = 20,
shape = 0.7),
tcfarg = list(scale = 1.1,
shape = 0.8))
)
dim(fit$alpha)
dim(fit$res.cov)
fit$m
fit$margarg
fit$margdist
## for random fields simulation
fit <- fitVAR(
spacepoints = 10,
p = 1,
margdist ='burrXII',
margarg = list(scale = 3, shape1 = .9, shape2 = .2),
p0 = 0.8,
stcsid = "clayton",
stcsarg = list(scfid = "weibull", tcfid = "weibull",
copulaarg = 2,
scfarg = list(scale = 20, shape = 0.7),
tcfarg = list(scale = 1.1, shape = 0.8))
)
dim(fit$alpha)
dim(fit$res.cov)
fit$m
fit$margarg
fit$margdist