RMmatrix: Matrix operator

Description Usage Arguments Value Note See Also Examples

View source: R/RMmodels.R

Description

RMmatrix is a multivariate covariance model depending on one multivariate covariance model, or one or several univariate covariance models C0,…. The corresponding covariance function is given by

C(h) = M phi(h) M^t

if a multivariate case is given. Otherwise it returns a matrix whose diagonal elements are filled with the univarate model(s) C0, C1, etc, and the offdiagonals are all zero.

Usage

1
2
RMmatrix(C0, C1,  C2, C3, C4, C5, C6, C7, C8, C9, M, vdim,
         var, scale, Aniso, proj)

Arguments

C0

a k-variate covariance RMmodel or a univariate model or a list of models joined by c

C1,C2,C3,C4,C5,C6,C7,C8,C9

optional univariate models

M

a k times k matrix, which is multiplied from left and right to the given model; M may depend on the location, hence it is then a matrix-valued function and C will be non-stationary with

C(x, y) = M(x) phi(x, y) M(y)^t

vdim

positive integer. This argument should be given if and only if a multivariate model is created from a single univariate model and M is not given. (In fact, if M is given, vdim must equal the number of columns of M)

var,scale,Aniso,proj

optional arguments; same meaning for any RMmodel. If not passed, the above covariance function remains unmodified.

Value

RMmatrix returns an object of class RMmodel.

Note

See Also

RMmodel, RFsimulate, RFfit.

Examples

 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
RFoptions(seed=0) ## *ANY* simulation will have the random seed 0; set
##                   RFoptions(seed=NA) to make them all random again


## Not run: 
## first example: bivariate Linear Model of Coregionalisation
x <- y <- seq(0, 10, 0.2)

model1 <- RMmatrix(M = c(0.9, 0.43), RMwhittle(nu = 0.3)) + 
  RMmatrix(M = c(0.6, 0.8), RMwhittle(nu = 2))
plot(model1)
simu1 <- RFsimulate(RPdirect(model1), x, y)
plot(simu1)


## second, equivalent way of defining the above model
model2 <- RMmatrix(M = matrix(ncol=2, c(0.9, 0.43, 0.6, 0.8)),
                  c(RMwhittle(nu = 0.3), RMwhittle(nu = 2)))
simu2 <- RFsimulate(RPdirect(model2), x, y)
stopifnot(all.equal(as.array(simu1), as.array(simu2)))


## third, equivalent way of defining the above model
model3 <- RMmatrix(M = matrix(ncol=2, c(0.9, 0.43, 0.6, 0.8)),
                   RMwhittle(nu = 0.3), RMwhittle(nu = 2))
simu3 <- RFsimulate(RPdirect(model3), x, y)
stopifnot(all(as.array(simu3) == as.array(simu2)))

## End(Not run)


## second example: bivariate, independent fractional Brownian motion
## on the real axis
x <- seq(0, 10, 0.1) 
modelB <- RMmatrix(c(RMfbm(alpha=0.5), RMfbm(alpha=1.5))) ## see the Note above
print(modelB)
simuB <- RFsimulate(modelB, x)
plot(simuB)


## third example: bivariate non-stationary field with exponential correlation
## function. The variance of the two components is given by the
## variogram of fractional Brownian motions.
## Note that the two components have correlation 1.
x <- seq(0, 10, 0.1)
modelC <- RMmatrix(RMexp(), M=c(RMfbm(alpha=0.5), RMfbm(alpha=1.5))) 
print(modelC)
simuC <- RFsimulate(modelC, x, x, print=1)
#print(as.vector(simuC))
plot(simuC)

RandomFields documentation built on Feb. 6, 2020, 5:13 p.m.