[Rsiena-help] Loop in "sienaDataCreate"
Tom Snijders
Tom.Snijders at nuffield.ox.ac.uk
Fri Jun 22 09:56:58 CEST 2012
Dear Philippe,
What is precisely going wrong? Is it only the name for the dependent variable, which is peers[[i]] instead of peers[[1]], peers[[2]], etc.? I think that the contents of the created Siena data sets probably are correct (which you could check).
In your example, the call
mydata.basic.model[[i]] <- sienaDataCreate(friends=peers[[i]])
will create the data set where the dependent network is called "friends"; here you can of course substitute any other name, but not an element of a vector or list even if these are strings. If you do not object to your list of Siena data sets all having the same name for the dependent variable, this is what you could do.
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
From: rsiena-help-bounces at lists.r-forge.r-project.org [mailto:rsiena-help-bounces at lists.r-forge.r-project.org] On Behalf Of Philippe Sulger
Sent: 21 June 2012 17:51
To: rsiena-help at lists.r-forge.r-project.org
Subject: [Rsiena-help] Loop in "sienaDataCreate"
Dear all
I try to program a loop over 5 different networks. Therein I use "sienaDataCreate". E.g.:
mydata.basic.model <- list();
for (i in c(1:5))
{mydata.basic.model[[i]] <- sienaDataCreate(peers[[i]])}
Where "peers" is defined/specified previously as a list over networks s.t.
peers <- list()
for (i in c(1:5))
{peers[[i]] <- sienaNet(
array( c(peers.data.w1[[i]], peers.data.w2[[i]]),
dim = c( dim(peers.data.w1[[i]])[1], dim(peers.data.w2[[i]])[1], 2)))}
The latter loop works. The former loop does not work. That is, mydata.basic.model[[1]], for instance, gets "peers[[i]]" as dependent variable (instead of "peers[[1]]". The same for the other networks.
But if I define the model-data separately for each network, i.e.,
mydata.basic.model[[1]] <- sienaDataCreate(peers[[1]])
mydata.basic.model[[2]] <- sienaDataCreate(peers[[2]])
it works.
What goes wrong?
Thank you for your efforts.
Best
Philippe
________________________________
Nuffield College is a Registered Charity No. 1137506. Registered Office: Nuffield College, New Road, Oxford, OX1 1NF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rsiena-help/attachments/20120622/e38f1202/attachment.html>
More information about the Rsiena-help
mailing list