<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I am currently running SIENA models in R, looking at the impact of geographical distance (as a dyadic covariate) in network evolution.
<o:p></o:p></p>
<p class="MsoNormal">I have ran models with two waves successfully by analysing the evolution among two network observations with equal node sets.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Now I am trying to analyse five waves of data (with geographical distance - recoded as integers between 0 and 255 - as a changing dyadic covariate).
<o:p></o:p></p>
<p class="MsoNormal">This requires, however, to use a file that indicates the composition change. As actors only exit and enter once, I have made a text file with two columns for each actor in the network, where numbers between 1 and 5 indicate the time of
entry and time of exit (separated by a tab). <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">My syntax is as follows:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""># load libraries<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">library(snow)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">library(network)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">library(rlecuyer)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">library(xtable)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""># set directory<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">Setwd("….")<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">list.files()<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""># load network data<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">network.data.w1 <- as.matrix(read.table("Network 1978-1982-b-Matched.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">network.data.w2 <- as.matrix(read.table("Network 1983-1987-b-Matched.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">network.data.w3 <- as.matrix(read.table("Network 1988-1992-b-Matched.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">network.data.w4 <- as.matrix(read.table("Network 1993-1997-b-Matched.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">network.data.w5 <- as.matrix(read.table("Network 1998-2002-a-Matched.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">distance.data.w1 <- data.matrix(read.table("Geomatrix_1982_all_int.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">distance.data.w2 <- data.matrix(read.table("Geomatrix_1987_all_int.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">distance.data.w3 <- data.matrix(read.table("Geomatrix_1992_all_int.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">distance.data.w4 <- data.matrix(read.table("Geomatrix_1997_all_int.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">composition.change.data <- as.list(read.table("composition_change.txt"))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""># a. set network dependent variables<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">coinv <- sienaNet(array(c(network.data.w1, network.data.w2, network.data.w3, network.data.w4, network.data.w5), dim=c(425, 425, 5)))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""># b. set attributes
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">distance <- varDyadCovar(array(c(distance.data.w1, distance.data.w2, distance.data.w3, distance.data.w4), dim=c(425,425,4)))<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">compChange <-sienaCompositionChange(composition.change.data, option=1)<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""># c. data specification<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">mod1 <- sienaDataCreate(coinv, distance, compChange)<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">But I get the following error message:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">Error in sienaDataCreate(coinv, distance, compChange) :
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""> composition change incorrect size: compChange<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<p class="MsoNormal">Do you have any idea what is going wrong here?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I also tried to import the file <span style="font-family:"Courier New"">
"composition_change.txt"</span> as a matrix, but then I got another error earlier, namely at the command
<span style="font-family:"Courier New"">sienaCompositionChange<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New"">Error in sienaCompositionChange(composition.change.data, option = 1) :
<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:36.0pt"><span style="font-family:"Courier New""> changelist must be a list<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I hope you can help me in resolving this problem.<o:p></o:p></p>
<p class="MsoNormal">Thanks a lot for your help in advance. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Kind regards,<o:p></o:p></p>
<p class="MsoNormal">Anne ter Wal<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:36.0pt"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB">Dr. Anne ter Wal</span></b><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><i><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB">Research Fellow</span></i><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB"> <o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB">Imperial College Business School<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB">Innovation and Entrepreneurship Group<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB">Tanaka Building, South Kensington Campus<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB">London SW7 2AZ<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB">E:
<a href="mailto:a.terwal@imperial.ac.uk"><span style="color:blue">a.terwal@imperial.ac.uk</span></a><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;color:black;mso-fareast-language:EN-GB">W:
<a href="http://www.anneterwal.com/"><span style="color:blue">www.anneterwal.com</span></a>
<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>