ergMargins error: non-conformable argument and structural zeros/ones

44 views Asked by At

I am quite an ergm newbie, so forgive me if the answer to my question is obvious to you. I modeled my network using ergms and try to facilitate interpretability by using the AMEs of ergms (function: ergm.AME()). Here, R returns two error messages:

  1. Error in t(x) %*% cbcoef : non-conformable arguments and an additional warning message:
  2. In edge.prob2(model) : There are structural zeros or ones. For these dyads, the predicted probabilities are not valid and must be manually replaced by 0 or 1, respectively.

I tried to find questions on both topics on stack overflow but could not find any. Do you know what the problem is? I do not have any problems when calculating the models using ergm.

For these models the code works:

model1 <- ergm(
  network ~ edges + mutual + gwidegree(decay=1, fixed=TRUE) +
    gwodegree(decay=1, fixed=TRUE),
  estimate = "MPLE"
)
model2 <- ergm(
  network ~ edges + mutual + gwidegree(decay=1, fixed=TRUE) +
    gwodegree(decay=1, fixed=TRUE) + gwesp(decay=1, fixed=TRUE),
  estimate = "MPLE"
)

model3 <- ergm.AME(model1, "edges")
model4 <- ergm.AME(model2, "edges")

However, when using a more complex model, the error messages occur:

model5 <- ergm(
  network ~ edges + mutual + gwidegree(decay=1, fixed=TRUE) +
    gwodegree(decay=1, fixed=TRUE) + gwesp(decay=1, fixed=TRUE) +
    edgecov(network1)  + edgecov(network2) + edgecov(network3) +
    edgecov(network4)     + nodeifactor("chronic") +
    nodeofactor("chronic")  +nodeifactor("nas") +
    nodeofactor("nas") + nodeofactor("sup") + 
    nodematch("chronic") + nodematch("nas") + 
    nodematch("gender") + nodefactor("gender"),
  estimate = "MPLE"
)
1

There are 1 answers

3
Michał On BEST ANSWER

Can you expand the question with the output of summary(model5)? There might be several reasons for that, but the one I'm suspecting is that your model has some of the coefficient estimates at Inf or -Inf. This trips the calculation of dyadic tie probabilities which are necessary to compute AMEs. Generally speaking, you may have not enough "variability" in your data to estimate a model that complex.

Thus the solution for you would be:

  1. Investigate if there are coef estimates at Inf or -Inf.
  2. Re-specify the model by
    • Making it simpler by dropping problematic terms, or
    • I'm suspecting that perhaps some combinations of values of nodal attributes are empty. If so, look into the distributions of these attributes and perhaps consider joining some categories.