compress {georob} | R Documentation |
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)
Arguments
m |
either a single symmetric, lower or upper triangular
matrix or a list of such matrices. The type of |
object |
a single compressed matrix or a list of such matrices
generated by |
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 |
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.
Author(s)
Andreas Papritz papritz@retired.ethz.ch.
See Also
georob
for (robust) fitting of spatial linear models.
Examples
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"]]))