Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make within and between subnetworks *mergeable* #32

Open
justinian336 opened this issue Jan 18, 2022 · 0 comments
Open

Make within and between subnetworks *mergeable* #32

justinian336 opened this issue Jan 18, 2022 · 0 comments

Comments

@justinian336
Copy link
Contributor

I'm talking about the networks in the est_between and est_within objects of the hergm response. Doing so would make it possible to recover the original network without having to store it.
Currently, the order of the vertex IDs is different, so it isn't straightforward to merge both networks. For example, assume that hergm was performed on a network g. Then:

# Extract the networks for each estimation
g_b <- hergm_res$est_between$network
g_w <- hergm_res$est_within$network

# Create a copy of the between-blocks network
g_merged <- network::network.copy(g_b)

# Extract the edgelist of the within-blocks network
e_w <- network::as.edgelist(g_w)

# Add those edges to the network `g`
network::add.edges(g_merged, e_w[,1], e_w[,2])

The resulting g_merged network should be the same as the original g, but it's not necessarily so. You can try this with the toyNet included in the package. The vertex names are properly assigned, but they are in a different order in both networks, so the internal IDs map to different nodes.

Being able to merge would make it unnecessary to pass the original network to functions such as gof_lighthergm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant