[R] multiple values for a factor using nodematch in ergm()

Ben Mazzotta benjamin.mazzotta at tufts.edu
Mon Aug 17 23:04:53 CEST 2009

Greetings, and many thanks for any insight you can offer.

I have a network object on which I'd like to simulate an ergm() using
{statnet}. Since the network object is large, I have not copied it here.

Each vertex has an attribute "language" which can take on integer values
greater than or equal to 1.

Is there a way to use the nodematch argument of ergm(), such that it
searches for any matches in the vertex attributes, rather than a 1-to-1

For example, given

mat <- matrix(1, ncol=4, nrow=4)
net <- network(mat)

lang <- list("A", c("A","B"), "B", "C")
net %v% "languages" <- lang

The truth table for the matches should read
H   T   V (for head, tail, value)
1   2   1
1   3   1
1   4   0
2   3   1
2   4   0
3   4   0

This is the standard implementation of ergm(... , nodematch()), I believe.
model2 <- ergm(net ~ nodematch(languages))

In the course of writing this post, I discovered that the net %v%
"languages" command above coerces the list "lang" to a vector.

I also have a dataset that specifies exhaustively whether dyads share a
language or not; but I am not sure how to enter dyad information
directly into the ergm() function.

Ben Mazzotta
PhD Candidate
Fletcher School, Tufts University
160 Packard Ave, Medford MA 02155
benjamin.mazzotta at tufts.edu

More information about the R-help mailing list