subset.Neighborhood | R Documentation |
Derives subsets based on neighborhood of a certain order. The scope is to obtain for every node with observed variable a neibourhood nodes and use these subsets for estimation.
## S3 method for class 'Neighborhood' subset( obj, eta, g, U_bar = NULL, vertices = base::setdiff(get.vertex.attribute(g, "name", V(g)), U_bar), matrixForm = FALSE, ... )
obj |
Object of class |
eta |
Order of the neighborhood |
g |
The graph, an |
U_bar |
The set of nodes for which data are missing. Default is NULL. If there are nodes for which the corresponding variables are not observed the set of these nodes should be provided here. This will avoid taking a variable with unobserved variable to be taken as a root. |
vertices |
Vertex(vertices) for which the neighboring set(s) are derived. Default is all vertices with observed variable. |
matrixForm |
a matrix of ones and zeros: one if the node is in the subset and zero otherwise. |
... |
additional arguments |
An object of class Neighborhood
containing two slots: slot $value
can be a matrix or list. If it
is a matrix, the number of columns is the same as the number of vertices
in the graph. The number of rows is the length of argument vertices
.
If it is a list, the list contains for each of the nodes in vertices
the neighborhood of order eta
. The slot $root
contains the vertices
for which the neighborhood sets are obtained. If there are nodes with missing data subsets will be created for
roots with available data only. A subset however can contain a node with missing data.
seg<- graph(c(1,2, 2,3, 2,4, 4,5, 5,6, 5,7), directed = FALSE) name_stat<- c("paris", "2", "meaux", "melun", "5", "nemours", "sens") seg<- set.vertex.attribute(seg, "name", V(seg), name_stat) rdsobj<- Neighborhood() subset(rdsobj, 2, seg) subset(rdsobj, 2, seg, U_bar = c("melun", "5"), matrixForm = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.