diff_cov {oeli} | R Documentation |
Difference and un-difference covariance matrix
Description
These functions difference and un-difference a covariance matrix with respect
to row ref
.
Usage
diff_cov(cov, ref = 1)
undiff_cov(cov_diff, ref = 1)
delta(ref = 1, dim)
Arguments
cov , cov_diff |
A (differenced) covariance |
ref |
An |
dim |
An |
Details
For differencing: Let be a covariance matrix of dimension
. Then
is the differenced covariance matrix with respect to row ,
where
is a difference operator that depends on the reference
row
. More precise,
the identity matrix of dimension
without row
and with
s in column
.
It can be computed with
delta(ref = k, dim = n)
.
For un-differencing: The "un-differenced" covariance matrix
cannot be uniquely computed from
.
For a non-unique solution, we add a column and a row of zeros
at column and row number
to
, respectively, and
add
to each matrix entry to make the result a proper covariance
matrix.
Value
A (differenced or un-differenced) covariance matrix
.
Examples
n <- 3
Sigma <- sample_covariance_matrix(dim = n)
k <- 2
# build difference operator
delta(ref = k, dim = n)
# difference Sigma
(Sigma_diff <- diff_cov(Sigma, ref = k))
# un-difference Sigma
undiff_cov(Sigma_diff, ref = k)