Saturday, January 25, 2014

Edgelists in RSiena

So, I've been storing my networks on my computer as full matrices. I have 3 different networks I'm looking at, with monthly snapshots, over 5 years, so there are a lot of files, and the full matrices are bulky.

In reading the RSiena manual, I saw that the native Siena formula is an edgelist, in the format "senderID, receiverID, value, wave". I thought that converting my matrices to edgelists in that format would really reduce the size of the files (not to mention being easier to debug as needed).

So, I've been trying to get RSiena to accept a very simple made-up edgelist that I created. It looks something like:

2  3  1  1
3  4  1  1
2  4  1  1
3  2  1  1
4  3  1  1
4  2  1  1

However, when I ran sienaDataCreateFromSession('../fakeEdgeList.txt') I got:

Error in if (session$Type[i] == "exogenous event") { :
   argument is of length zero

After re-reading the help(sienaDataCreateFromSession) file again, I realized that it's actually expecting a sort of config file, and the file names are outlined there. So, I created my config file.

data1,observation,../fakeEdgeList.txt,Siena,,1 2,network,Yes,.,1,6

I then got
Error: could not find function "network.size"

I realized I needed to install the 'network' package.

However, I'm still not there. After install network, I get

Error in network.size(namefiles[[1]]) :
  network.size requires an argument of class network.

So, for some reason, my file isn't being converted to a network object, but I'm going to have to wait until Monday to try to figure out why. :)

No comments:

Post a Comment