View source: R/matrix_completions_main.R
| complete_Gamma | R Documentation |
Given a graph and a (partial) variogram matrix Gamma, returns a full
variogram matrix that agrees with Gamma in entries corresponding to edges
of graph and whose corresponding precision matrix, obtained by
Gamma2Theta(), has zeros in entries corresponding to non-edges of graph.
For results on the existence and uniqueness of this completion, see
\insertCitehen2022;textualgraphicalExtremes.
complete_Gamma(Gamma, graph = NULL, ...)
Gamma |
Numeric \dxd variogram matrix. |
graph |
|
... |
Further arguments passed to |
If graph is decomposable, Gamma only needs to be specified on
the edges of the graph, other entries are ignored.
If graph is not decomposable, the graphical completion algorithm requires
a fully specified (but non-graphical) variogram matrix Gamma to begin with.
Such a matrix can be obtained using the (currently archived) CRAN package npf as follows.
The package can be installed from GitHub,
but is currently not available on CRAN and therefore not directly used here.
Gamma <- edmcr::npf(Gamma, 1*!is.na(Gamma), d = NROW(Gamma)-1)$D
Completed \dxd variogram matrix.
Gamma2Theta()
Other matrix completion related topics:
complete_Gamma_decomposable(),
complete_Gamma_general(),
complete_Gamma_general_demo(),
complete_Gamma_general_split()
## Block graph:
Gamma <- rbind(
c(0, .5, NA, NA),
c(.5, 0, 1, 1.5),
c(NA, 1, 0, .8),
c(NA, 1.5, .8, 0)
)
complete_Gamma(Gamma)
## Alternative representation of the same completion problem:
my_graph <- igraph::graph_from_adjacency_matrix(rbind(
c(0, 1, 0, 0),
c(1, 0, 1, 1),
c(0, 1, 0, 1),
c(0, 1, 1, 0)
), mode = "undirected")
Gamma_vec <- c(.5, 1, 1.5, .8)
complete_Gamma(Gamma_vec, my_graph)
## Decomposable graph:
G <- rbind(
c(0, 5, 7, 6, NA),
c(5, 0, 14, 15, NA),
c(7, 14, 0, 5, 5),
c(6, 15, 5, 0, 6),
c(NA, NA, 5, 6, 0)
)
complete_Gamma(G)
## Non-decomposable graph:
G <- rbind(
c(0, 5, 7, 6, 6),
c(5, 0, 14, 15, 13),
c(7, 14, 0, 5, 5),
c(6, 15, 5, 0, 6),
c(6, 13, 5, 6, 0)
)
g <- igraph::make_ring(5)
complete_Gamma(G, g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.