Description Usage Arguments Details Value Examples
View source: R/simulate.tergm.R
simulate
is used to draw from temporal
exponential family random network models in their natural parameterizations.
See tergm
for more information on these models.
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63  ## S3 method for class 'tergm'
simulate(
object,
nsim = 1,
seed = NULL,
coef = coefficients(object),
constraints = object$constraints,
monitor = object$targets,
time.slices = 1,
time.start = NULL,
time.burnin = 0,
time.interval = 1,
control = control.simulate.tergm(),
output = c("networkDynamic", "stats", "changes", "final", "ergm_state"),
nw.start = NULL,
stats = FALSE,
verbose = FALSE,
...
)
## S3 method for class 'network'
simulate_formula(
object,
nsim = 1,
seed = NULL,
coef = NULL,
constraints = ~.,
monitor = NULL,
time.slices = 1,
time.start = NULL,
time.burnin = 0,
time.interval = 1,
time.offset = 1,
control = control.simulate.formula.tergm(),
output = c("networkDynamic", "stats", "changes", "final", "ergm_state"),
stats = FALSE,
verbose = FALSE,
...,
basis = ergm.getnetwork(object),
dynamic = FALSE
)
## S3 method for class 'networkDynamic'
simulate_formula(
object,
nsim = 1,
seed = NULL,
coef = attr(basis, "coef"),
constraints = ~.,
monitor = NULL,
time.slices = 1,
time.start = NULL,
time.burnin = 0,
time.interval = 1,
time.offset = 1,
control = control.simulate.formula.tergm(),
output = c("networkDynamic", "stats", "changes", "final", "ergm_state"),
stats = FALSE,
verbose = FALSE,
...,
basis = eval_lhs.formula(object),
dynamic = FALSE
)

object 
for

nsim 
Number of replications (separate chains of networks) of the
process to run and return. The 
seed 
Random number integer seed. See 
coef 
Parameters for the model. 
constraints 
A onesided formula specifying one or more constraints on the support of the distribution of the networks being modeled. Multiple constraints may be given, separated by “+” operators. Together with the model terms in the formula and the reference measure, the constraints define the distribution of networks being modeled. The default is See the ERGM constraints documentation for the constraints implemented in the ergm package. Other packages may add their own constraints. Note that not all possible combinations of constraints are supported. 
monitor 
A onesided formula specifying one or more terms whose
value is to be monitored. If 
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. 
time.interval 
Number of time steps between successive recordings of network statistics. 
control 
A list of control parameters for algorithm tuning.
Constructed using

output 
A character vector specifying output type: one of

nw.start 
A specification for the starting network to be used by

stats 
Logical: Whether to return
model statistics. This is not the recommended method:
use 
verbose 
Logical: If TRUE, extra information is printed as the Markov chain progresses. 
... 
Further arguments passed to or used by methods. 
time.offset 
Argument specifying the offset between the point when the
state of the network is sampled ( 
basis 
For the 
dynamic 
Logical; if 
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 basis
(or the left hand side of object
if basis
is missing), by default with the same model
and parameters.
The starting network for the tergm
object method
(simulate.tergm
) is determined by the nw.start
argument.
If time.start
is specified, it is used as the initial
time index of the simulation.
If time.start
is not specified (is NULL
), then
if the object
carries a time stamp from which to start
or resume the simulation, either in the form
of a "time"
network attribute (for the
network
method — see the
lasttoggle
"API") or
in the form of an net.obs.period
network attribute (for the
networkDynamic
method), this attribute will be used. (If
specified, time.start
will override it with a warning.)
Othewise, the simulation starts at 0.
Depends on the output
argument:
"stats" 
If 
"networkDynamic" 
A
When 
"changes" 
An integer matrix with four columns ( 
"final" 
A 
"ergm_state" 
The 
Note that when using simulate_formula.networkDynamic
with either
"final"
or "ergm_state"
for output
, the nodes
included in these objects are those produced by network.collapse
at the start time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24  data(samplk)
# Fit a transition from Time 1 to Time 2
samplk12 < tergm(list(samplk1, samplk2)~
Form(~edges+mutual+transitiveties+cyclicalties)+
Diss(~edges+mutual+transitiveties+cyclicalties),
estimate="CMLE")
# direct simulation from tergm object
sim1 < simulate(samplk12, nw.start="last")
# equivalent simulation from formula with network LHS;
# must pass dynamic=TRUE for tergm simulation
sim2 < simulate(samplk2 ~ Form(~edges+mutual+transitiveties+cyclicalties) +
Diss(~edges+mutual+transitiveties+cyclicalties),
coef = coef(samplk12),
dynamic=TRUE)
# the default simulate output is a networkDynamic, and we can simulate
# with a networkDynamic LHS as well
sim3 < simulate(sim2 ~ Form(~edges+mutual+transitiveties+cyclicalties) +
Diss(~edges+mutual+transitiveties+cyclicalties),
coef = coef(samplk12),
dynamic=TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.