makeSigmaB {SpatioTemporal} | R Documentation

## Create Block Covariance Matrix (Equal Block Sizes)

### Description

Function that creates a block covariance matrix with equal sized blocks. Used to construct the Sigma_B matrix.

### Usage

    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)

### Arguments

`pars` | List of parameters for each block; if not a list a single block matrix is assumed. Should match parameters suggested by `parsCovFuns`.
`dist` | Distance matrix.
`type` | Name(s) of covariance functions, see `namesCovFuns`.
`nugget` | Vector of nugget(s) to add to the diagonal of each matrix.
`symmetry` | `TRUE`/`FALSE` flag if the `dist` is symmetric, resulting in a symmetric covariance matrix.
`ind2.to.1` | Vectors, that for each index along the second dimension gives a first dimension index, used only if `symmetry=FALSE` to determine which covariances should have an added nugget (collocated sites).
`sparse` | If `TRUE`, return a block diagonal sparse matrix, see `bdiag.spam`.
`diff` | Vector with two components indicating with respect to which parameter(s) that first and/or second derivatives should be computed. E.g. `diff=c(0,0)` indicates no derivatives, `diff=c(1,0)` indicates first derivative wrt the first parameter, `diff=c(1,2)` indicates second cross derivative wrt the first and second parameters, etc.

### Details

Any parameters given as scalars will be `rep`-ed to match `length(pars)`.

### Value

Block covariance matrix of size `dim(dist)*n.blocks`.

### Author(s)

Johan Lindstrom

### See Also

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`

### Examples

    ##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))

[Package SpatioTemporal version 1.1.9.1 Index]