View source: R/simulate.tergm.R
simulate.tergm  R Documentation 
simulate
is used to draw from temporal
exponential family random network models in their natural parameterizations.
See tergm
for more information on these models.
## 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 
Seed value (integer) for the random number generator. See

coef 
Parameters for the model. 
constraints 
A formula specifying one or more constraints
on the support of the distribution of the networks being modeled. Multiple constraints
may be given, separated by “+” and “” operators. See
The default is to have no constraints except those provided through
the Together with the model terms in the formula and the reference measure, the constraints define the distribution of networks being modeled. It is also possible to specify a proposal function directly either
by passing a string with the function's name (in which case,
arguments to the proposal should be specified through the
Note that not all possible combinations of constraints and reference measures are supported. However, for relatively simple constraints (i.e., those that simply permit or forbid specific dyads or sets of dyads from changing), arbitrary combinations should be possible. 
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 
A logical or an integer to control the amount of
progress and diagnostic information to be printed. 
... 
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.
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.