leifeld/btergm

Update btergm to work with ergm 4.0

krivit opened this issue · 1 comments

Hi, Philip! We are hoping to release ergm 4.0 in 2-3 weeks. The current release candidate code is at https://github.com/statnet/ergm/ .

Here's what I am seeing for btergm:

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure (test-btergm.R:147:3): mtergm estimation works ──────────────────────
round(unname(coef(fit1)), 1) not equal to round(unname(coef(fit2)), 1).
1/3 mismatches
[2] 0.1 - 0 == 0.1
── Failure (test-btergm.R:148:3): mtergm estimation works ──────────────────────
round(unname(coef(fit2)), 2) not equal to c(-1.18, 0.06, 0).
2/3 mismatches (average diff: 0.015)
[1] -1.16 - -1.18 ==  0.02
[2]  0.05 -  0.06 == -0.01
── Failure (test-btergm.R:149:3): mtergm estimation works ──────────────────────
unname(round(fit2@se, 2)) not equal to c(0.19, 0.08, 0.07).
1/3 mismatches
[3] 0.08 - 0.07 == 0.01
── Failure (test-gof.R:45:3): edgeprob works with ergm, btergm, and mtergm object with curved terms ──
dim(ep) not equivalent to c(900, 10).
1/2 mismatches
[2] 18 - 10 == 8

[ FAIL 4 | WARN 21 | SKIP 2 | PASS 45 ]

Looks like all the problems are stochastic, except for test-gof.R.

I am seeing two issues there:

  • I think btergm has been affected by some changes in the way curved ERGMs are handled, which breaks edgeprob().
    1. My most immediate suggestion is to see if you can simplify it by using the predict() method for ergm (i.e., ? predict.ergm). If you need it to be tweaked so that it could be used for this purpose, please let me know. (And, I think we've stepped on your toes there a bit; sorry about that.)
    2. Part of the "conflict" appears to be that the number of terms the curved terms expand to depends on the network size, which creates a problem when the ergm had been fit on a composed block-diagonal network but the individual networks' predictions are done separately. I am not 100% sure what the best way is to handle that at the moment, except perhaps to construct an ergm_model for each subnetwork and use a separate etamap for each statistic.
  • Trying to fit an ergm with edges and curved gw*degree to a network whose degree distribution is close to binomial is near-nonidentifiable, so it's not a great test case: some times estimation converges, other times it doesn't.

Please let me know if I could be of help.

Hi Pavel! Thanks for the notes. I have replaced those unit tests and made a few other minor changes in response. The new version will go to CRAN in a few days. I haven't used your predict function yet, but will consider it in the future. It was more important to get this back out on CRAN for now. No worries about stepping on my toes -- I only implemented edgeprob because this functionality was previously missing; but it's of course great if something like this is now available in ergm!