Raj
Raj

Reputation: 43

r sna equiv.clust more than one graph

I would like to provide more than one graph as input to the equiv.clust function in the sna package. For example

library(ergm)
library(sna) 

data(florentine) 
flobusiness # first relation
flomarriage # second relation

eq<-equiv.clust(flobusiness)
b<-blockmodel(flobusiness,eq,h=10)
plot(b)

So far so good. I get the output I expect. However, how do I include both relations in the equiv.clust and blockmodel commands?

According to the Usage in documentation

equiv.clust(dat, g=NULL, equiv.dist=NULL, equiv.fun="sedist",
    method="hamming", mode="digraph", diag=FALSE,
    cluster.method="complete", glabels=NULL, plabels=NULL, ...)

where

dat        one or more graphs.

Specifically, I am requesting to know how to provide two or more graphs in as the dat part of the argument. Thanks a ton

Upvotes: 1

Views: 325

Answers (1)

tvg
tvg

Reputation: 418

try entering the graphs as a list, as in:

equiv.clust(list(flobusiness,flomarriage))

not sure if that will work but in general I think you need to use lists to analyze multiple graphs. though in this case, it depends on whether you want two separate blockmodels in which case you could just loop or use

lapply(equiv.clust, list(flobusiness,flomarriage))

and then a slightly more complicated statement for the block model, or whether you want a blockmodel of the combined network in which case you could just add them together

Upvotes: 1

Related Questions