Chris T.
Chris T.

Reputation: 1801

How to get simulated network from siena07 output?

Is there a way to subset simulated network in matrix form from R siena07() function output? According to R's documentation, simulated networks are stored as edgelist in sims

"If returnDeps=TRUE: list of simulated dependent variables (networks, behaviour). Networks are given as a list of edgelists, one for each period. The structure of sims is a nested list: sims[[run]][[group]][[dependent variable]][[period]]. If x$maxlike=TRUE and there is only one group and one period, the structure is [[run]][[dependent variable]]."

But I don't quite understand where to find [[group]] label.

At below I generated some fake data and created a siena07 output. Hope someone could help pointing out the way to 1) subset the simulated network from a particular period and 2) convert it to 50 by 50 matrix. So that I can compare it to observed network and calculate various prediction accuracy statistics.

library(igraph)
library(network)
library(RSiena)

mynet1 <- sienaDependent(array(c(s501, s502), dim=c(50, 50, 2)))
mybeh <- sienaDependent(s50a[,1:2], type="behavior")
mycov <- c(rep(1:3,16),1,2) # artificial, just for trying
mydycov <- matrix(rep(1:5, 500), 50, 50) # also artificial, just for trying
mydata <- sienaDataCreate(mynet1, mybeh)
myeff <- getEffects(mydata)
myeff <- includeEffects(myeff, transTies, cycle3)
# Shorter phases 2 and 3, just for example:
myalgorithm <- sienaAlgorithmCreate(nsub=1, n3=50, seed=122, projname="sim")

(ans <- siena07(myalgorithm, data=mydata, effects=myeff, returnDeps=TRUE, batch=TRUE))

str(ans$sims)

Upvotes: 0

Views: 30

Answers (0)

Related Questions