makeSigmaB {SpatioTemporal} | R Documentation |
Function that creates a block covariance matrix with equal sized blocks. Used to construct the Sigma_B matrix.
makeSigmaB(pars, dist, type = "exp", nugget = 0, symmetry = dim(dist)[1] == dim(dist)[2], ind2.to.1 = 1:dim(dist)[2], sparse = FALSE, diff = 0)
pars |
List of parameters for each block; if not a list a single
block matrix is assumed. Should match parameters suggested by
|
dist |
Distance matrix. |
type |
Name(s) of covariance functions, see
|
nugget |
Vector of nugget(s) to add to the diagonal of each matrix. |
symmetry |
|
ind2.to.1 |
Vectors, that for each index along the second dimension
gives a first dimension index, used only if |
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. |
Any parameters given as scalars will be rep
-ed to match
length(pars)
.
Block covariance matrix of size dim(dist)*n.blocks
.
Johan Lindstrom
Other block matrix functions: blockMult
,
calc.FXtF2
, calc.FX
,
calc.mu.B
, calc.tFXF
,
calc.tFX
, makeCholBlock
,
makeSigmaNu
Other covariance functions: crossDist
,
evalCovFuns
, makeSigmaNu
,
namesCovFuns
, parsCovFuns
,
updateCovf
##First create some random locations x <- rnorm(5) y <- rnorm(5) ##compute distance matrix D <- crossDist( cbind(x,y) ) ##create a block diagonal matrix exponential covariance matrix ##with different range, sill, and nugget pars <- list(c(.3,2), c(2,1), c(1,3)) nugget <- c(.5,0,1) Sigma1 <- makeSigmaB(pars, D, type="exp", nugget=nugget) ##or using different covariance functions for each block Sigma2 <- makeSigmaB(pars, D, type=c("exp","exp2","cubic"), nugget=nugget) ##make a cross-covariance matrix Dcross <- D[1:3,c(1,1,2,2)] Sigma.cross <- makeSigmaB(pars, Dcross, type="exp", nugget=nugget, ind2.to.1=c(1,1,2,2))