[Rsiena-help] help with composition change file
Tom Snijders
Tom.Snijders at nuffield.ox.ac.uk
Wed Dec 7 10:50:52 CET 2011
Dear Anne,
There is an example of sienaCompositionChangeFromFile in
http://www.stats.ox.ac.uk/~snijders/siena/lab-compositionChange.zip
(see the R scripts page in the Siena website).
I shall try to add a bit of material to the manual about this.
Best wishes,
Tom
================================================================
Tom A.B. Snijders
Professor of Statistics in the Social Sciences
Department of Politics and Department of Statistics
Nuffield College
University of Oxford
tel. +44-01865-278599
-----Original Message-----
From: rsiena-help-bounces at r-forge.wu-wien.ac.at [mailto:rsiena-help-bounces at r-forge.wu-wien.ac.at] On Behalf Of Ruth Ripley
Sent: 06 December 2011 23:19
To: rsiena-help at r-forge.wu-wien.ac.at
Subject: Re: [Rsiena-help] help with composition change file
Dear Anne,
You need to use the function sienaCompositionChangefromFile to read your composition change data in. The alternative list format is rather difficult to produce. as.list() on a data frame creates a list of columns not rows.
Regards,
Ruth
On 06/12/2011 19:23, ter Wal, Anne wrote:
> Hi,
>
> I am currently running SIENA models in R, looking at the impact of
> geographical distance (as a dyadic covariate) in network evolution.
>
> I have ran models with two waves successfully by analysing the
> evolution among two network observations with equal node sets.
>
> 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).
>
> 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).
>
> My syntax is as follows:
>
> # load libraries
>
> library(snow)
>
> library(network)
>
> library(rlecuyer)
>
> library(xtable)
>
> # set directory
>
> Setwd("....")
>
> list.files()
>
> # load network data
>
> network.data.w1 <- as.matrix(read.table("Network
> 1978-1982-b-Matched.txt"))
>
> network.data.w2 <- as.matrix(read.table("Network
> 1983-1987-b-Matched.txt"))
>
> network.data.w3 <- as.matrix(read.table("Network
> 1988-1992-b-Matched.txt"))
>
> network.data.w4 <- as.matrix(read.table("Network
> 1993-1997-b-Matched.txt"))
>
> network.data.w5 <- as.matrix(read.table("Network
> 1998-2002-a-Matched.txt"))
>
> distance.data.w1 <-
> data.matrix(read.table("Geomatrix_1982_all_int.txt"))
>
> distance.data.w2 <-
> data.matrix(read.table("Geomatrix_1987_all_int.txt"))
>
> distance.data.w3 <-
> data.matrix(read.table("Geomatrix_1992_all_int.txt"))
>
> distance.data.w4 <-
> data.matrix(read.table("Geomatrix_1997_all_int.txt"))
>
> composition.change.data <-
> as.list(read.table("composition_change.txt"))
>
> # a. set network dependent variables
>
> coinv <- sienaNet(array(c(network.data.w1, network.data.w2,
> network.data.w3, network.data.w4, network.data.w5), dim=c(425, 425,
> 5)))
>
> # b. set attributes
>
> distance <- varDyadCovar(array(c(distance.data.w1, distance.data.w2,
> distance.data.w3, distance.data.w4), dim=c(425,425,4)))
>
> compChange <-sienaCompositionChange(composition.change.data, option=1)
>
> # c. data specification
>
> mod1 <- sienaDataCreate(coinv, distance, compChange)
>
> But I get the following error message:
>
> Error in sienaDataCreate(coinv, distance, compChange) :
>
> composition change incorrect size: compChange
>
> Do you have any idea what is going wrong here?
>
> I also tried to import the file "composition_change.txt" as a matrix,
> but then I got another error earlier, namely at the command
> sienaCompositionChange
>
> Error in sienaCompositionChange(composition.change.data, option = 1) :
>
> changelist must be a list
>
> I hope you can help me in resolving this problem.
>
> Thanks a lot for your help in advance.
>
> Kind regards,
>
> Anne ter Wal
>
> *Dr. Anne ter Wal*
>
> /Research Fellow/
>
> Imperial College Business School
>
> Innovation and Entrepreneurship Group
>
> Tanaka Building, South Kensington Campus
>
> London SW7 2AZ
>
> E: a.terwal at imperial.ac.uk <mailto:a.terwal at imperial.ac.uk>
>
> W: www.anneterwal.com <http://www.anneterwal.com/>
>
>
>
> _______________________________________________
> Rsiena-help mailing list
> Rsiena-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rsiena-he
> lp
_______________________________________________
Rsiena-help mailing list
Rsiena-help at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rsiena-help
Nuffield College is a Registered Charity No. 1137506. Registered Office: Nuffield College, New Road, Oxford, OX1 1NF
More information about the Rsiena-help
mailing list