[Rsiena-help] Error message selecting actors

Ruth M. Ripley ruth at stats.ox.ac.uk
Mon Mar 8 17:15:02 CET 2010


Dear Maarten,

Are you only wanting to include 14 actors?

I am not sure what the problem is. If you want to save the 
workspace and send me a copy, I will look at it. (There is an option on 
the menu to save workspaces.) And confirm which version of R and RSiena 
you are using.

Regards,

Ruth
--
Ruth M. Ripley,                         Email:ruth at stats.ox.ac.uk
Dept. of Statistics,                    http://www.stats.ox.ac.uk/~ruth/
University of Oxford,                   Tel:   01865 282851
1 South Parks Road, Oxford OX1 3TG, UK  Fax:   01865 272595

On Mon, 8 Mar 2010, Maarten Van Zalk wrote:

> Dear Ruth,
>
> I tried the 'sum' command, and now run into the following problem:
>
>
>> sum(use)
> [1] 14
>> friendship <- sienaNet(array(c(net.w1[use, use], net.w2[use, 
>> use],net.w3[use, use]),dim=c(sum(use), sum(use), 3)))
>> mydata <- sienaDataCreate(friendship,shy,self,depr)
>> myeff <- getEffects(mydata)
> Error in rep(shortnames, times = (1 + as.numeric(endowment))) :
> invalid 'times' argument
>> 
>
> Is there something I am missing?
>
> Kind regards,
>
> Maarten
>
>
> On Mar 8, 2010, at 15:55 , Ruth M. Ripley wrote:
>
>> Dear Maarten,
>> 
>> If the 796 is all the actors, you need to reduce it to the number you
>> actually include. This can be found as sum(use):
>> friendship <- sienaNet(array(c(net.w1[use, use], net.w2[use, use],
>>> net.w3[use, use]),dim=c(sum(use), sum(use), 3)))
>> 
>> Regards,
>> 
>> Ruth
>> --
>> Ruth M. Ripley,                         Email:ruth at stats.ox.ac.uk
>> Dept. of Statistics,                    http://www.stats.ox.ac.uk/~ruth/
>> University of Oxford,                   Tel:   01865 282851
>> 1 South Parks Road, Oxford OX1 3TG, UK  Fax:   01865 272595
>> 
>> 
>> On Mon, 8 Mar 2010, Maarten Van Zalk wrote:
>> 
>>> Dear ruth,
>>> 
>>> An additional question on selecting specific actors:
>>> 
>>> As I run the following syntax, I get the error:
>>> 
>>>> library(RSiena)
>>>> library(snow)
>>>> library(rlecuyer)
>>>> setwd('/Users/maartenselfhout/Desktop/CrowdStudy/justin')
>>>> net.w1 <- as.matrix(read.table("W3SIENA.dat"))
>>>> net.w2 <- as.matrix(read.table("W4SIENA.dat"))
>>>> net.w3 <- as.matrix(read.table("W5SIENA.dat"))
>>>> rad <- as.matrix(read.table("radical.dat"))
>>>> depr <- as.matrix(read.table("depress.dat"))
>>>> self <- as.matrix(read.table("selfesteem.dat"))
>>>> shy <- as.matrix(read.table("shy.dat"))
>>>> net.w1[net.w1 %in% c(6,9)] <- NA
>>>> net.w2[net.w2 %in% c(6,9)] <- NA
>>>> net.w3[net.w3 %in% c(6,9)] <- NA
>>>> rad[rad %in% c(99)] <- NA
>>>> depr[depr %in% c(99)] <- NA
>>>> self[self %in% c(99)] <- NA
>>>> shy[shy %in% c(99)] <- NA
>>>> use <- rad[, 1] == 1
>>>> friendship <- sienaNet(array(c(net.w1[use, use], net.w2[use, use],
>>> net.w3[use, use]),dim=c(796, 796, 3)))
>>>> shy <- sienaNet(shy[use, ], type='behavior')
>>>> depr <- varCovar(val = depr[use, ])
>>>> self <- varCovar(val = self2[use, ])
>>> Error in varCovar(val = self2[use, ]) : object 'self2' not found
>>>> self <- varCovar(val = self[use, ])
>>>> mymodel <- model.create(useStdInits = TRUE, projname = 'crowd')
>>>> mydata <- sienaDataCreate(friendship,depr,self,shy,rad)
>>> Error: invalid object in sienaDataCreate matrix
>>>> mydata <- sienaDataCreate(friendship,depr,self,shy)
>>>> myeff <- getEffects(mydata)
>>> Error in storage.mode(test) <- "logical" : subscript out of bounds
>>>> 
>>> 
>>> Do you have any idea why this error arises?
>>> 
>>> It does NOT arise when I run the syntax without the 'use' command
>>> 
>>> Thanks!
>>> 
>>> Kind regards,
>>> 
>>> Maarten Selfhout-Van Zalk
>>> 
>>> 
>>> On Feb 15, 2010, at 12:59 , Ruth M. Ripley wrote:
>>> 
>>>> Dear Maarten,
>>>> 
>>>> There are no special facilities: you would need to extract the
>>>> subsets of
>>>> the matrices yourself before creating the Siena network object.
>>>> Using the
>>>> command line, after reading in some data:
>>>> 
>>>> friend.data.w1 <- as.matrix(read.table("s50-network1.dat"))
>>>> friend.data.w2 <- as.matrix(read.table("s50-network2.dat"))
>>>> drink <- as.matrix(read.table("s50-alcohol.dat"))
>>>> smoke <- as.matrix(read.table("s50-smoke.dat"))
>>>> 
>>>> To select the actors with the first column of smoke equal to 1, say,
>>>> 
>>>> use <- smoke[, 1] == 1
>>>> 
>>>> friendship <- sienaNet(array(c(friend.data.w1[use, use],
>>>>     friend.data.w2[use, use]), dim=c(38, 38, 2)))
>>>> 
>>>> alcohol <- sienaNet(drink[use, ], type="behavior")
>>>> 
>>>> To do this via the gui, you would need to do the subsetting outside R.
>>>> 
>>>> Regards,
>>>> 
>>>> Ruth
>>>> 
>>>> PS I have copied this message to the rsiena-help mailing list. I see
>>>> two
>>>> benefits to using the lists: others might find the information
>>>> useful too,
>>>> and if I am busy someone else might be able to help!
>>>> --
>>>> Ruth M. Ripley,                         Email:ruth at stats.ox.ac.uk
>>>> Dept. of Statistics,                    http://www.stats.ox.ac.uk/~ruth/
>>>> University of Oxford,                   Tel:   01865 282851
>>>> 1 South Parks Road, Oxford OX1 3TG, UK  Fax:   01865 272595
>>>> 
>>>> 
>>>> On Mon, 15 Feb 2010, Maarten Van Zalk wrote:
>>>> 
>>>>> Dear Ruth,
>>>>> 
>>>>> Is it possible in RSiena to select certain actors for the analysis?
>>>>> So
>>>>> if you have a variable X you want to use to select individuals (for
>>>>> example, all individuals with a score of 1), Can you select only
>>>>> these
>>>>> individuals?
>>>>> 
>>>>> Thanks for your help!
>>>>> 
>>>>> Kind regards,
>>>>> 
>>>>> Maarten Van Zalk
>>>>> 
>>>> 
>>> 
>>> 
>> 
>


More information about the Rsiena-help mailing list