compress: Compact Storage of Symmetric and Triangular Matrices

Description Usage Arguments Value Author(s) See Also Examples

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

1
2
3
  compress(m)

  expand(object)

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

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 non-redundant 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 squared or compressed matrices then these additional components are returned unchanged.

Author(s)

Andreas Papritz andreas.papritz@env.ethz.ch.

See Also

georob for (robust) fitting of spatial linear models.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 

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"]]))

## End(Not run)

georob documentation built on June 4, 2021, 5:06 p.m.