statnet / ergm

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

error with `init.method = "zeros"` #516

Closed chad-klumb closed 1 year ago

chad-klumb commented 1 year ago

When running

require(ergm)
nw <- network.initialize(10, directed = FALSE)
e <- ergm(nw ~ edges, target.stats = 10, control = list(init.method = "zeros"))

with ergm@master I get the error

Error in structure(mple.lik, vcov = 0) : object 'mple.lik' not found

apparently coming from this line:

https://github.com/statnet/ergm/blob/8eeb514f81b9a72113a5492341bf303169df3f50/R/logLik.ergm.R#L110

krivit commented 1 year ago

Looks like a regression from the refactor of ergm(). Will fix.

krivit commented 1 year ago

Actually no, looks like the problem precedes the refactor.

The problem is that if init="zeros", MPLE call is bypassed, and then if MLE ≡ MPLE, MCMLE is never run. Thus, it's not just a likelihood calculation error, and it has nothing to do with target stats: there is no estimate in the first place.