makeSigmaNu {SpatioTemporal} | R Documentation |
Function that creates a block covariance matrix with unequally sized blocks. Used to construct the Sigma_nu matrix.
makeSigmaNu(pars, dist, type = "exp", nugget = 0, random.effect = 0, symmetry = dim(dist)[1] == dim(dist)[2], blocks1 = dim(dist)[1], blocks2 = dim(dist)[2], ind1 = 1:dim(dist)[1], ind2 = 1:dim(dist)[2], ind2.to.1 = 1:dim(dist)[2], sparse = FALSE, diff = 0)
pars |
Vector of parameters, as suggested by
|
dist |
Distance matrix. |
type |
Name of the covariance function to use, see
|
nugget |
A value of the nugget or a vector of length
|
random.effect |
A constant variance to add to the covariance matrix,
can be interpereted as either and partial sill with infinite
range or as a random effect with variance given by |
symmetry |
|
blocks1, blocks2 |
Vectors with the size(s) of each of the
diagonal blocks, usually |
ind1, ind2 |
Vectors indicating the location of each element in the
covariance matrix, used to index the |
ind2.to.1 |
Vectors, that for each index along the second dimension,
|
sparse |
If |
diff |
Vector with two components indicating with respect to which
parameter(s) that first and/or second derivatives should be
computed. E.g. |
Block covariance matrix of size
length(ind1)
-by-length(ind2)
.
Johan Lindstrom
Other block matrix functions: blockMult
,
calc.FXtF2
, calc.FX
,
calc.mu.B
, calc.tFXF
,
calc.tFX
, makeCholBlock
,
makeSigmaB
Other covariance functions: crossDist
,
evalCovFuns
, makeSigmaB
,
namesCovFuns
, parsCovFuns
,
updateCovf
##First create some random locations x <- rnorm(5) y <- rnorm(5) ##compute distance matrix D <- crossDist( cbind(x,y) ) #a vector of locations I <- c(1,2,3,1,4,4,3,2,1,1) T <- c(1,1,1,2,2,3,3,3,3,4) ##create a block diagonal matrix consisting of four parts with ##exponential covariance. sigma.nu <- makeSigmaNu(c(.4,2), D, "exp", nugget=0.1, blocks1 = c(3,2,4,1), ind1 = I) ##and cross covariance sigma.nu.c <- makeSigmaNu(c(.4,2), D, "exp", nugget=0.1, blocks1 = c(3,2,4,1), ind1 = I, blocks2 = c(0,0,3,1), ind2 = I[7:10]) ##compare the cross-covariance with the relevant part of sigma.nu range(sigma.nu.c-sigma.nu[,7:10]) ##an alternative showing the use of loc.ind2.to.1 sigma.nu.c <- makeSigmaNu(c(.4,2), D[,4:3], "exp", nugget=0.1, blocks1 = c(3,2,4,1), ind1 = I, blocks2 = c(0,0,2,0), ind2 = 1:2, ind2.to.1=4:3) ##compare the cross-covariance with the relevant part of sigma.nu range(sigma.nu.c-sigma.nu[,6:7])