statnet / ergm.multi

Fit, Simulate and Diagnose Exponential-Family Models for Multiple or Multilayer Networks
Other
14 stars 1 forks source link

How to use nodematch, nodecov in Bipartite networks #28

Open LinPing-lin opened 2 months ago

LinPing-lin commented 2 months ago

I built the multilayer network containing the bipartite network according to the instructions in the documentation, such as:

net1 # this have 1304 nodes network2 # bipartite netwrok:192 nodes in first mode, 1034 nodes in second mode

init <- network.initialize(192, directed = FALSE) network1 <- combine_networks(list(net1,init)) # In order to construct the same number of nodes as a two-mode network

network1 %v% "mode" <- rep(1:2,c(1304,192))

flo <- Layer(network1, network2, .active=list(~mode==1, ~TRUE))

But node attributes are not displayed in the second mode network,and I don't know how to be able to use b1cov, b2cov and nodematch.

something like this:

**`bergm.fit3 <- ergm(bipartite_net ~ edges + b1cov('Degree') + b2cov('Degree') + nodematch('Degree') ,control = control.ergm(MCMC.burnin=20000, MCMC.samplesize=10000,seed = 123))

summary(bergm.fit3)`**

Thanks for the reply.

krivit commented 2 months ago

Can you try using add.vertices() and permute.vertexIDs() from network to pad out network1? combine_networks() does other things, which you might not want it to.

Other than that, I think the Layer() example continues with how to reference bipartite layers.