# makeSigmaNu: Create Block Covariance Matrix (Unequal Block Sizes) In SpatioTemporal: Spatio-Temporal Model Estimation

## Description

Function that creates a block covariance matrix with unequally sized blocks. Used to construct the Sigma_nu matrix.

## Usage

 1 2 3 4 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)

## Arguments

 pars Vector of parameters, as suggested by parsCovFuns. dist Distance matrix. type Name of the covariance function to use, see namesCovFuns. nugget A value of the nugget or a vector of length dim(dist)[1] giving (possibly) location specific nuggets. 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 random.effect for the mean value. symmetry TRUE/FALSE flag if the dist matrix is symmetric. If also ind1==ind2 and blocks1==blocks2 the resulting covariance matrix will be symmetric. blocks1, blocks2 Vectors with the size(s) of each of the diagonal blocks, usually mesa.model\$nt. If symmetry=TRUE then blocks2 defaults to blocks1 if missing. ind1, ind2 Vectors indicating the location of each element in the covariance matrix, used to index the dist-matrix to determine the distance between locations, usually mesa.model\$obs\$idx. If symmetry=TRUE and then ind2 defaults to ind1 if missing. ind2.to.1 Vectors, that for each index along the second dimension, ind2, gives a first dimension index, ind1, 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.

## Value

Block covariance matrix of size length(ind1)-by-length(ind2).

Johan Lindstrom