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. ========

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 /////////////\\\\\
## 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))
)
## Warning: number of items to replace is not a multiple of replacement
## length
## ========  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. ========

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'
## SAN failed or is not applicable. Increase burn-in if there are problems.
## Error: Name missmatch in target.stats''. Specify by position.

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 \\\\\
## ========  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",
)
## Error: Name missmatch in target.stats''. Specify by position.
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 \\\\\
## Subphase 2.7 \\\\\
## Subphase 2.8 \\\///\\\\\
## Subphase 2.9 \////\\\\\
## ========  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'
## SAN failed or is not applicable. Increase burn-in if there are problems.
## Error: Name missmatch in target.stats''. Specify by position.
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 \\\\\
## ========  Phase 3: Simulate from the fit and estimate standard errors. ========
## Subphase 2.9 \/\////////////////////////////////////////\////////\\\\\
## Subphase 2.10 \\\\\
## Subphase 2.11 \\\\\
## ========  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]
## edges   -4.1 -4.079 -4.022 -4.139 -4.1 -3.986
## degree3 -4.0 -4.000 -4.000 -4.000 -4.0 -4.000