statnet / ergm

Fit, Simulate and Diagnose Exponential-Family Models for Networks
Other
94 stars 36 forks source link

MPLE warning "glm.fit: fitted probabilities numerically 0 or 1 occurred" #518

Closed krivit closed 1 year ago

krivit commented 1 year ago

We currently propagate this warning to the user, but is there any point it doing it? What is the user supposed to do or not do based on it? @handcock , @drh20drh20 , I think you put it in place.

drh20drh20 commented 1 year ago

I don't know whether I added that, but if so then I think it would have been to alert the user that maximization has likely failed due to the existence of a direction of recession. At this point we might check for and warn of that in some other way, no? It's fine with me to remove this warning.

krivit commented 1 year ago

Don't we already do detection of directions of recession with the code from Christian?

handcock commented 1 year ago

I believe it is produced by glm and can be removed. I left it in originally as I thought it might prove helpful in some circumstances but has not been, to my knowledge.

mbojan commented 1 year ago

I think I ran across this warning some time ago when fitting to a vector target statistics. I can't find it now what data and model these were. My uneducated guess at the time was that my targets imply to many ties for some subgroups to hold (thus some GLM on the way implied P=1...). However I just tried to cook-up a similar simplified scenario (such as the one below), but could not generate the warning. When is it supposed to appear? Perhaps it is not wise to suppress it, but rather to turn it into something more informative?

library(ergm)
net0 <- network.initialize(24, directed = FALSE)
net0 %v% "group" <- rep(1:2, each = 12)
summary(net0 ~ mm(~ group, levels = NULL, levels2 = NULL))
fit <- ergm(
  net0 ~ mm(~ group, levels = NULL, levels2 = NULL),
  target.stats = c(7, 0, 77) # group 2 is complete for 66 ties, so 77 is too many
)