Draw from the distribution of an Separable Temporal Exponential Family Random Graph Model
Description
simulate
is used to draw from separable temporal exponential family
random network models in their natural parameterizations.
See stergm
for more information on these models.
Usage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48  ## S3 method for class 'stergm'
simulate(object, nsim=1, seed=NULL,
coef.form = object$formation.fit$coef,
coef.diss = object$dissolution.fit$coef,
constraints = object$constraints,
monitor = object$targets,
time.slices=1, time.start=NULL, time.burnin=0, time.interval=1,
control=control.simulate.stergm(),
statsonly=NULL,
output=c("networkDynamic", "stats", "changes", "final"),
nw.start = NULL,
stats.form = FALSE,
stats.diss = FALSE,
duration.dependent = NULL,
verbose=FALSE,
...)
## S3 method for class 'network'
simulate(object, nsim=1, seed=NULL,
formation, dissolution,
coef.form, coef.diss,
constraints = ~.,
monitor = NULL,
time.slices=1, time.start=NULL, time.burnin=0, time.interval=1, time.offset=1,
control=control.simulate.network(),
statsonly=NULL,
output=c("networkDynamic", "stats", "changes", "final"),
stats.form = FALSE,
stats.diss = FALSE,
duration.dependent = NULL,
verbose=FALSE,
...)
## S3 method for class 'networkDynamic'
simulate(object, nsim=1, seed=NULL,
formation = attr(object, "formation"),
dissolution = attr(object, "dissolution"),
coef.form = attr(object, "coef.form"),
coef.diss = attr(object, "coef.diss"),
constraints = NVL(attr(object, "constraints"), ~.),
monitor = attr(object, "monitor"),
time.slices=1, time.start=NULL, time.burnin=0, time.interval=1, time.offset=1,
control=control.simulate.network(),
statsonly=NULL,
output=c("networkDynamic", "stats", "changes"),
stats.form = FALSE,
stats.diss = FALSE,
duration.dependent = NULL,
verbose=FALSE,
...)

Arguments
object 
an R object of type

formation, dissolution 
Onesided 
nsim 
Number of replications (separate chains of networks) of
the process to run and return. The 
seed 
Random number integer seed.
See 
coef.form 
Parameters for the model from which the postformation network is drawn. 
coef.diss 
As 
constraints 
A onesided formula specifying one or more constraints
on the support of the distribution of the networks being modeled,
using syntax similar to the It is also possible to specify a proposal function directly
by passing a string with the function's name. In that case,
arguments to the proposal should be specified through the
The default is See the ERGM constraints documentation for
the constraints implemented in the For STERGMs in particular, the constraints apply to the postformation and the postdissolution network, rather than the final network. This means, for example, that if the degree of all vertices is constrained to be less than or equal to three, and a vertex begins a time step with three edges, then, even if one of its edges is dissolved during its time step, it won't be able to form another edge until the next time step. This behavior may change in the future. Note that not all possible combinations of constraints are supported. 
monitor 
Either a onesided formula specifying one or more terms whose
value is to be monitored, or a string containing 
time.slices 
Number of time slices (or statistics) to return from each replication of the dynamic process. See below for
return types. Defaults to 1, which, if 
time.start 
An optional argument specifying the time point at which the simulation is to start. See Details for further information. 
time.burnin 
Number of time steps to discard before starting to collect network
statistics. Actual network will only be returned if 
time.interval 
Number of time steps between successive recordings of network
statistics. Actual network will only be returned if 
time.offset 
Argument specifying the offset between the point when the state of the network is sampled ( 
control 
A list of control parameters for algorithm
tuning. Constructed using 
statsonly 
Deprecated in favor of 
output 
A character vector specifying output type: one of "networkDynamic" (the default), "stats", and "changes", with partial matching allowed. See Value section for details. 
nw.start 
A specification for the starting network to be used by

stats.form, stats.diss 
Logical: Whether to return
formation/dissolution model statistics. This is not the recommended
method: use 
duration.dependent 
Logical: Whether the model terms in formula or model are duration dependent. E.g., if a durationdependent term is used in estimation/simulation model, the probability of forming or dissolving a tie may dependent on the age the dyad status. 
verbose 
Logical: If TRUE, extra information is printed as the Markov chain progresses. 
... 
Further arguments passed to or used by methods. 
Details
The dynamic process is run forward and the results are returned. For
the method for networkDynamic
, the simulation is resumed
from the last generated time point of object
, by default with
the same model and parameters.
The starting network for the stergm
object method
(simulate.stergm
) is determined by the nw.start
argument.
The time index of the start of the simulation is determined as follows:
If
time.start
is specified, it is used as the initial time index of the simulation.If
time.start
is not specified (isNULL
), then if theobject
carries a time stamp from which to start or resume the simulation, either in the form of a"time"
network attribute (for thenetwork
method — see thelasttoggle
"API") or in the form of annet.obs.period
network attribute (for thenetworkDynamic
method), this attribute will be used. (If specified,time.start
will override it with a warning.)Othewise, the simulation starts at 0.
Value
Depends on the output
argument:
"stats" 
If If When 
"networkDynamic" 
A Additionally, attributes (
When 
"changes" 
An integer matrix with four columns ( Additionally, same attributes ( When 
"final" 
A
Additionally, attributes (
When 
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31  logit<function(p)log(p/(1p))
coef.form.f<function(coef.diss,density) log(((1+exp(coef.diss))/(density/(1density)))1)
# Construct a network with 20 nodes and 20 edges
n<20
target.stats<edges<20
g0<network.initialize(n,dir=TRUE)
g1<san(g0~edges,target.stats=target.stats,verbose=TRUE)
S<10
# To get an average duration of 10...
duration<10
coef.diss<logit(11/duration)
# To get an average of 20 edges...
dyads<network.dyadcount(g1)
density<edges/dyads
coef.form<coef.form.f(coef.diss,density)
# ... coefficients.
print(coef.form)
print(coef.diss)
# Simulate a networkDynamic
dynsim<simulate(g1,formation=~edges,dissolution=~edges,
coef.form=coef.form,coef.diss=coef.diss,
time.slices=S,verbose=TRUE)
# "Resume" the simulation.
dynsim2<simulate(dynsim,time.slices=S,verbose=TRUE)
