georob (version 0.3-19)

compress: Compact Storage of Symmetric and Triangular Matrices

Description

The utility function compress stores symmetric or triangular matrices compactly by retaining only the diagonal and either the lower or upper off-diagonal elements. The function expand restores such compressed matrices again to a square form.

Usage

compress(m)

expand(object)

Value

If m is a single square matrix then compress generates a compressed matrix, which is a list with two components:

diag

a vector with the diagonal elements of m.

tri

a vector with off-diagonal elements.

If m is a list of square matrices then the result is also a list of compressed matrices.

expand creates a square matrix if object is a list with components diag and tri and a list of square matrices if

object is a list of such lists. If m or objects are lists that contain other components than square or compressed matrices then these additional components are returned unchanged.

Arguments

m

either a single symmetric, lower or upper triangular matrix or a list of such matrices. The type of m (or of its component matrices) must be defined by the attribute struc with possible values "sym" (symmetric), "lt" (lower triangular) or "ut" (upper triangular).

object

a single compressed matrix or a list of such matrices generated by compress, see Value. The type of object (or of its components) must be defined by the attribute struc with possible values "sym" (symmetric), "lt" (lower triangular) or "ut" (upper triangular).

Author

Andreas Papritz papritz@retired.ethz.ch.

See Also

georob for (robust) fitting of spatial linear models.

Examples

Run this code
data(meuse)

r.logzn.rob <- georob(log(zinc) ~ sqrt(dist) + ffreq, data = meuse,
    locations = ~ x + y, variogram.model = "RMexp",
    param = c(variance = 0.15, nugget = 0.05, scale = 200),
    tuning.psi = 1)

cov2cor(expand(r.logzn.rob[["cov"]][["cov.betahat"]]))

Run the code above in your browser using DataLab