While working through the tutorial I ran into a problem in an ergm.ego call. The problematic term (in this case) turned out to be nodefactor, and the issue arises when the alters have a category that the egos don't. Here's a self-contained example of the same phenomenon.
library(ergm.ego)
# set up egodata
n <- 100
e <- 150
ds <- c(10,15,5,20)
y <- network.initialize(n, directed=FALSE)
y %v% "cat1" <- sample(letters[1:4],n,replace=TRUE)
y <- san(y~edges+degree(0:3), target.stats=c(e,ds))
y.e <- as.egodata(y)
# no problem with this one
ergm.ego(y.e ~ nodefactor("cat1"))
# now add a new category to alters only
w <- which(y.e$alters$cat1 == "a")
w <- w[w %% 2 == 0]
y.e$alters$cat1[w] <- "e"
# error
ergm.ego(y.e ~ nodefactor("cat1"))
The error for me is:
Error in vector.namesmatch(target.stats, names(nw.stats)) :
Name missmatch in "target.stats". Specify by position.
The error appears to happen in function ergm. Debugging showed that target.stats includes the e category while nw.stats doesn't.
While working through the tutorial I ran into a problem in an
ergm.ego
call. The problematic term (in this case) turned out to benodefactor
, and the issue arises when the alters have a category that the egos don't. Here's a self-contained example of the same phenomenon.The error for me is:
The error appears to happen in function
ergm
. Debugging showed thattarget.stats
includes thee
category whilenw.stats
doesn't.The offending line of code is
Would appreciate someone confirming the above error.