set up network

net <- network.initialize(10,directed=F)
net[1,2] <- net[2,3] <- net[3,4] <- net[4,5] <- net[5,6] <- 1
mod1<- mod2<- mod3<- mod4<- mod5<- mod6<- mod7<- mod8<- mod9 <- NULL

### Target edges

Specifying all initial coefs; note the difference between init.form and san

mod1 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = 10, edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets=~edges, estimate="EGMME",
control=control.stergm(init.form=c(-2,-4), SAN.control=control.san(coef=-2))
)
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 //////////\\\\\
## Subphase 2.2 \\\\\
## Subphase 2.3 \\\\\
## Subphase 2.4 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========
## Subphase 2.5 //////////////\/\\\\///\/\\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========

init.method set to zeros

mod2 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = 10, edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets=~edges, estimate="EGMME", control=control.stergm(init.method='zeros'))
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 //////
## Warning: Effective degrees of freedom (0.332854352745714) must exceed the
## number of varying parameters (1). P-value will not be computed.
## /
## Warning: Effective degrees of freedom (0.629926709434456) must exceed the
## number of varying parameters (1). P-value will not be computed.
## ////\\\\\
## Subphase 2.2 \\\\\
## Subphase 2.3 \\\\\
## Subphase 2.4 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========

Default SAN coefs

mod3 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = 10, edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets=~edges, estimate="EGMME",
control=control.stergm(init.form=c(-2,-4))
)
## SAN initial coefficients should have same length as targets. Setting them to SAN defaults.
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 /////////\\\\\
## Subphase 2.2 \\\\\
## Subphase 2.3 \\\\\
## Subphase 2.4 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========
## Subphase 2.5 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========

No initial coefs

modx <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = 10, edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets=~edges, estimate="EGMME"
)
## Error: No initial parameter method for specified model and targets
## combination is implemented. Specify via control$init.form and ## control$init.diss .

### Target edges and degree

targets = formation

mod4 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = c(10,1), edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets='formation', estimate="EGMME",

)
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Iteration 1 of at most 20:
## Convergence test P-value: 0e+00
## The log-likelihood improved by 7.466
## Iteration 2 of at most 20:
## Convergence test P-value: 3.1e-71
## The log-likelihood improved by 6.221
## Iteration 3 of at most 20:
## Convergence test P-value: 3.4e-51
## The log-likelihood improved by 1.605
## Iteration 4 of at most 20:
## Convergence test P-value: 1.9e-15
## The log-likelihood improved by 0.7536
## Iteration 5 of at most 20:
## Convergence test P-value: 1.3e-03
## The log-likelihood improved by 0.04054
## Iteration 6 of at most 20:
## Convergence test P-value: 8.2e-01
## Convergence detected. Stopping.
## The log-likelihood improved by 0.0002039
##
## This model was fit using MCMC.  To examine model diagnostics and check for degeneracy, use the mcmc.diagnostics() function.
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 2 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 3 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 4 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 5 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 //////////////////////////////////////////////////\\\\\
## Subphase 2.2 \\\\\
## Subphase 2.3 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\/\\\\\
## Subphase 2.4 \\\\\
## Subphase 2.5 \\\\\
## Subphase 2.6 \\\\\
## Subphase 2.7 \\\\\
## Subphase 2.8 \\\\\
## Subphase 2.9 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========

targets = formation, with initial coefs

mod5 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = c(10,1), edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets='formation', estimate="EGMME",
control=control.stergm(init.form=c(-2,0))
)
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 //////////\\\///\\\\\
## Subphase 2.2 \///////\\\\/\\\\\
## Subphase 2.3 \\\\/////\///\\\\\
## Subphase 2.4 \\\\/\\\\\
## Subphase 2.5 \\\\//////////////////////////////////////////////////\\\\/////\\\\\
## Subphase 2.6 \\\\\
## Subphase 2.7 \\\\\
## Subphase 2.8 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========
## Subphase 2.9 /////////////////////////////////////\/\/\\\/\\\/\\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========

targets edges and degree

mod6 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = c(10,1), edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets=~edges+degree(3), estimate="EGMME",
)
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
## Iteration 1 of at most 20:
## Convergence test P-value: 0e+00
## The log-likelihood improved by 0.6425
## Iteration 2 of at most 20:
## Convergence test P-value: 1.8e-01
## The log-likelihood improved by 0.005902
## Iteration 3 of at most 20:
## Convergence test P-value: 8.4e-01
## Convergence detected. Stopping.
## The log-likelihood improved by 0.0002295
##
## This model was fit using MCMC.  To examine model diagnostics and check for degeneracy, use the mcmc.diagnostics() function.
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 2 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 3 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 4 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 5 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 ///////////////////\/////////////////////////////\\\/////////////////////////////////\/\/\/\//\//\/\//\\///\//////////////\\\\\
## Subphase 2.2 \\\/\\\\\
## Subphase 2.3 \\\/\\\//\\\\\
## Subphase 2.4 \//\\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========
mod7 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = c(10,1), edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets=~edges+degree(3), estimate="EGMME",
control=control.stergm(init.form=c(-2,0))
)
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 /////////\\/\\\\/\\/\\\//\\\\/\\\\\
## Subphase 2.2 \\\\\
## Subphase 2.3 \\\\\
## Subphase 2.4 \/\/\//\/////////////////////////////////////////////////\//\/\\\\\
## Subphase 2.5 \\\\\
## Subphase 2.6 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========

targets edges and offset(degree)

mod8 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = c(10,1), edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets=~edges+offset(degree(3)), estimate="EGMME"
)
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Warning: is.na() applied to non-(list or vector) of type 'NULL'
## Iteration 1 of at most 20:
## Convergence test P-value: 0e+00
## The log-likelihood improved by 9.73
## Iteration 2 of at most 20:
## Convergence test P-value: 0e+00
## The log-likelihood improved by 6.342
## Iteration 3 of at most 20:
## Convergence test P-value: 1.8e-11
## The log-likelihood improved by 0.4177
## Iteration 4 of at most 20:
## Convergence test P-value: 9.8e-03
## The log-likelihood improved by 0.02604
## Iteration 5 of at most 20:
## Convergence test P-value: 5.9e-01
## Convergence detected. Stopping.
## The log-likelihood improved by 0.001363
##
## This model was fit using MCMC.  To examine model diagnostics and check for degeneracy, use the mcmc.diagnostics() function.
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 2 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 3 :
## None of the parameters have a detectable effect. Increasing jitter.
## Attempt 4 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 //\\/\//////////////////////////////////////\\/\//////////////////////\\//\\//\\/////////\\\\\
## Subphase 2.2 \\\/\\\\\
## Subphase 2.3 \\//\\\\\
## Subphase 2.4 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========
mod9 <- stergm(net, formation= ~edges + offset(degree(3)),
offset.coef.form=-4,
target.stats = c(10,1), edapprox=T,
dissolution= ~offset(edges),
offset.coef.diss=3,
targets=~edges+offset(degree(3)), estimate="EGMME",
control=control.stergm(init.form=c(-2,0))
)
## ========  Phase 1: Burn in, get initial gradient values, and find a configuration under which all targets vary. ========
## Burning in... Done.
## Attempt 1 :
## All parameters have some effect and all statistics are moving. Proceeding to Phase 2.
## ========  Phase 2: Find and refine the estimate. ========
## Subphase 2.1 /////////////\\///\\\\\
## Subphase 2.2 /\\\\\
## Subphase 2.3 \/////\\////////////////////////////////////////////////\\\\\
## Subphase 2.4 \\///////////\\\\\
## Subphase 2.5 \//\\/////\\\\\
## Subphase 2.6 \\\\\
## Subphase 2.7 \\\\\
## Subphase 2.8 \\\\\
## Subphase 2.9 \\\\\
## Subphase 2.10 \\\\\
## Subphase 2.11 \\\\\
## Subphase 2.12 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========

### Fitted coefficients

res = sapply(list(mod1, mod2, mod3, mod4, mod5, mod6, mod7, mod8, mod9) ,
function(x) coef(x)\$formation, simplify=F)
do.call(cbind, res)
##           [,1]   [,2]  [,3]   [,4]   [,5]   [,6]   [,7]   [,8]   [,9]
## edges   -4.086 -4.114 -4.04 -4.056 -4.074 -4.298 -4.059 -4.237 -4.142
## degree3 -4.000 -4.000 -4.00 -4.000 -4.000 -4.000 -4.000 -4.000 -4.000