Why won’t this simple model on a small network converge?

Part 2: with ergm 3.11 (the last version in the ergm 3.x series)

#remotes:::install_version('ergm', "3.11.0")
library(ergm)
# install.packages("ergm")
packageVersion('ergm')
## [1] '3.11.0'

Fit the desired model with all default settings

set.seed(0)
nw <- network.initialize(n = 118, directed=F)
fit <- ergm(nw~edges + degree(0), target.stats = c(173, 43))

It does fit, although this warning is generated many times:

# Warning: Model statistics 'degree0' are linear combinations of some set of preceding statistics at the current stage of the estimation. This may indicate that the model is nonidentifiable.

What is the fit, and how well does it do?

fit
## 
## Call:
## ergm(formula = nw ~ edges + degree(0), target.stats = c(173, 
##     43))
## 
## MCMC sample of size 1024 based on: 
##   edges  degree0  
##  0.9117   6.6318  
## 
## Monte Carlo MLE Coefficients:
##   edges  degree0  
##  0.8438   6.6318
goffit <- gof(fit, control=control.gof.ergm(nsim=10))
plot(goffit)

So clearly it’s totally off.

How about some old-school fitting parameters?

fit <- ergm(nw~edges + degree(0), target.stats = c(173, 43), 
  control = control.ergm(
    MCMLE.maxit = 500,
    MCMC.interval = 1e4,
    MCMC.samplesize = 1e4,
    MCMC.effectiveSize=NULL
  ))
## Error in ergm.MCMLE(init, nw, model, initialfit = (initialfit <- NULL), : MCMLE estimation stuck. There may be excessive correlation between model terms, suggesting a poor model for the observed data. If target.stats are specified, try increasing SAN parameters.

So that actually yielded an error.

How about some of the newer fitting parameters?

fit <- ergm(nw~edges + degree(0), target.stats = c(173, 43), 
  control = control.ergm(
    MCMLE.maxit = 500,
    MCMC.interval = 1e4,
    MCMC.samplesize = 1e4,
    MCMC.effectiveSize=NULL,
    main.method = "Stochastic-Approximation",
    MCMLE.termination = "Hotelling"
  ))
##     edges   degree0 
## -2.751651  5.309412 
## Starting burnin of 160000 steps
## Phase 1: 200 steps (interval = 10000)
## Returned from Phase 1
## 
##  gain times inverse variances:
##  5.102041 1.275510
## Phase 2: (samplesize = 371)
## End of iteration 1; Updating the number of sub-phases to be 23
## theta_1 = -10370.098590; change statistic[1] = -173.000000
## theta_2 = -705.149772; change statistic[2] = 75.000000
## 
## End of iteration 2; Updating the number of sub-phases to be 58
## theta_1 = -4191.527161; change statistic[1] = -173.000000
## theta_2 = -1374.792629; change statistic[2] = 75.000000
## 
## End of iteration 3; Updating the number of sub-phases to be 147
## theta_1 = -2575.455732; change statistic[1] = -115.000000
## theta_2 = -1385.315588; change statistic[2] = -41.000000
## 
## End of iteration 4; Updating the number of sub-phases to be 371
## theta_1 = -424.307773; change statistic[1] = -114.000000
## theta_2 = -814.684210; change statistic[2] = -43.000000
## 
## Phase 3: MCMC-Newton-Raphson
fit
## 
## Call:
## ergm(formula = nw ~ edges + degree(0), target.stats = c(173, 
##     43), control = control.ergm(MCMLE.maxit = 500, MCMC.interval = 10000, 
##     MCMC.samplesize = 10000, MCMC.effectiveSize = NULL, main.method = "Stochastic-Approximation", 
##     MCMLE.termination = "Hotelling"))
## 
## MCMC sample of size 1000 based on: 
##   edges  degree0  
##  -649.8   -334.7  
## 
## Monte Carlo MLE Coefficients:
##   edges  degree0  
##   976.4  -3587.1
goffit <- gof(fit, control=control.gof.ergm(nsim=10))
plot(goffit)
## Error in out[, na.omit(i), drop = FALSE]: subscript out of bounds

The coefficients, the weird error and the observed plot make clear that this is completely not working.

Let’s just see if the issue arises with fewer isolates:

mycontrol <- control.ergm(MCMLE.maxit = 50,
                              MCMC.interval = 1e4,
                              MCMC.samplesize = 1e4,
                              MCMC.effectiveSize=NULL
  )
(fit <- ergm(nw~edges + degree(0), target.stats = c(173, 20), control = mycontrol))
## Error in ergm.MCMLE(init, nw, model, initialfit = (initialfit <- NULL), : Unconstrained MCMC sampling did not mix at all. Optimization cannot continue.

Doesn’t show signs of converging.