social network analysis, tergm

Hello everyone,

I have a question about modification of temporal social network data. I am currently working on allyNet data of Cranmer et al. (2012) on international military alliances. (https://cran.r-project.org/web/packages/xergm.common/index.html)
This network data consists of military alliance formation of 164 countries between 1980-200 and every year has an adjacency matrix of 164x164.
I want investigate the data by dividing it into 4-time intervals but I could not manage to do it.
Is there anyone can help me?

Hi, and welcome!

It's hard to give a useful answer to this type of question without a reproducible example, called a reprex. It would be necessary to guess at the data structure. In this case, however, reprex doesn't play nice with the code.

I've had to guess that you mean the allyNet list in the alliances dataset in the package. If that is the case, it is a list of lists, or allyNet[1] ... .

> library(xergm)
> library(xergm.common)
> data("alliances")
> class(allyNet)
[1] "list"
> allyNet[1]
$`1981`
 Network attributes:
  vertices = 164 
  directed = FALSE 
  hyper = FALSE 
  loops = FALSE 
  multiple = FALSE 
  bipartite = FALSE 
  total edges= 625 
    missing edges= 0 
    non-missing edges= 625 

 Vertex attribute names: 
    cinc polity vertex.names year 

No edge attributes

> allyNet[[1]][1,]
  [1] 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
 [64] 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0
[127] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0

The last call returns the vertices list.

To collect them by 5-year increments,

allyNet[1:5]

That just gives you five lists from which you can extract vertices. I'm not sure that's all you're looking for, though.

1 Like