spam (version 2.5-1)

precmat: IGMRF Precision Matrices

Description

Fast ways to create sparse precision matrices for various IGMRF.

Usage

precmat(n, season=12, m=n, A=NULL, order=1, ... , type="RW1")
precmat.RW1(n)
precmat.RW2(n)
precmat.RWn(n, order=3)
precmat.season(n, season=12)
precmat.IGMRFreglat(n, m, order=1, anisotropy=1)
precmat.IGMRFirreglat(A, eps=getOption("spam.eps"))

Arguments

n

dimension of the field.

type

the type of the IGMRF.

season

length of season.

m

second dimension (in case of a regular lattice).

A

adjacency matrix (see below).

order

order for higher order RWs.

anisotropy

anisotropy factor, between 0 and 2.

eps

tolerance level.

arguments passed to individual functions.

Value

A sparse precision matrix.

Details

precmat is a wrapper that calls the other functions according to the argument type.

Implements many of the precision matrices discussed in Chapter 3 of Rue and Held (2005). For example, precmat.RW1, precmat.RW2 and precmat.season are given in equations (3.22), (3.40) and (3.59); precmat.IGMRFreglat on page 107. Note that for the latter we reverse the order of the dimension here!

If adjacency matrix is a regular matrix, it is coerced to a spam object. Only the structure is used. Make sure, that the diagonal is empty.

References

Rue and Held (2005).

See Also

precmat.GMRFreglat, rmvnorm.prec, adjacency.landkreis.

Examples

Run this code
# NOT RUN {
n <- 10
Q <- precmat.RW2( n)
# rmvnorm.prec(1, Q=Q) # does not work, because the matrix is singular.

Q
# }
# NOT RUN {
<!-- %*%cbind(1,1:n) -->
# }

Run the code above in your browser using DataLab