I'm trying to run a HERGM and MLERGM models on network data, but my code always returns the same error:
Error in rep(" ", max_char - num_chars[i]) : invalid 'times' argument In addition: Warning >message: In max(num_chars) : no non-missing arguments to max; returning -Inf
I'm using a much larger network dataset, consisting of 5969 nodes and explanatory variables, but I've made a smaller, reproducible example below of some basic edges-only models.
library(mlergm)
library(hergm)
#HERGM
my_sociomatrix <- matrix(round(runif(20*20)), # edge values
nrow = 20, #nrow must be same as ncol
ncol = 20)
test.network <-
network(x = my_sociomatrix,
directed = F, matrix.type = "adjacency")
test.model <-
hergm(test.network ~
edges_ij,
max_iter = 4,
method = "ml")
#MLERGM
my_sociomatrix <- matrix(round(runif(30*30)),
nrow = 30,
ncol = 30)
node_memb <- c(rep(1, 10), rep(2, 10), rep(3, 10))
mlnet <- mlnet(network = my_sociomatrix,
node_memb = node_memb)
model_est <- mlergm(mlnet ~ edges)
My question is, why am I encountering such an error? And what can I do to solve it?
I have contacted the authors of the package and they told me that the recent updates in the ERGM package, on which the HERGM package relies, has caused the technical difficulties. Though I have to say that even when rolling those updates back and using a earlier version of the ERGM package, the problems persist.