ts_sims
simulates the network evolution nsims
times given
the existing network net1
, the defined evaluation function ts_eval()
,
the included network statistics (taken from ans
, myeff
, or statistics
)
and the corresponding parameter estimates (or starting values) taken from
ans
, myeff
, or statistics
.
Usage
ts_sims(
ans = NULL,
mydata = NULL,
myeff = NULL,
startvalues = NULL,
net1 = NULL,
ccovar = NULL,
statistics = NULL,
nsims = 1000,
p2step = c(1, 0, 0),
dist1 = NULL,
dist2 = NULL,
modet1 = "degree",
modet2 = "degree",
chain = FALSE,
verbose = TRUE,
parallel = FALSE
)
ts_sim(
ans = NULL,
mydata = NULL,
myeff = NULL,
startvalues = NULL,
net1 = NULL,
ccovar = NULL,
statistics = NULL,
p2step = c(1, 0, 0),
dist1 = NULL,
dist2 = NULL,
modet1 = "degree",
modet2 = "degree",
chain = FALSE,
verbose = TRUE
)
Arguments
- ans
Results of class sienaFit, produced by a call to
RSiena::siena07()
- mydata
Siena data object created by a call to
RSiena::sienaDataCreate()
- myeff
Siena effects object created by a call to
RSiena::getEffects()
- startvalues
if not provided manually, taken from results of
ans$theta
, or ifans
is not provided fromsummary(myeff)$initialValue
.- net1
adjacency matrix, the adjacency matrix representing the relations between actors at Time=1. Valid values are 0 and 1. If not provided manually, retrieved from
ans
ormydata
.- ccovar
data frame with named time-constant covariates. If not provided manually, retrieved from
ans
ormydata
.- statistics
list of statistics of
RsienaTwoStep
, see:ts_degree()
and DETAILS. If not provided manually, retrieved fromans
ormyeff
.- nsims
numeric, number of simulations.
- p2step
numeric vector of length 3, setting the ratio of ministep, twostep and twoministeps. This parameter is passed to
ts_sims()
.- dist1
numeric, minimal path length between ego1 and ego2 at time1 in order to be allowed to start a cooperation. If
NULL
all dyads are allowed to start a cooperation. This parameter is passed tots_sims()
.- dist2
numeric, minimal path length between ego1 and ego2 at time2 in order for twostep to be counted as cooperation. This parameter is passed to
ts_sims()
.- modet1
string, indicating the type of ties being evaluated at time1. "degree" considers all ties as undirected. "outdegree" only allows directed paths starting from ego1 and ending at ego2. "indegree" only allows directed paths starting from ego2 and ending at ego2. This parameter is passed to
ts_sims()
.- modet2
string, indicating the type of ties being evaluated at time2. "degree" considers all ties as undirected. "outdegree" only allows directed paths starting from ego1 and ending at ego2. "indegree" only allows directed paths starting from ego2 and ending at ego2. This parameter is passed to
ts_sims()
.- chain
TRUE/FALSE, set to
TRUE
if you want to save all the subsequent networks (after the ministep or twostep) during the simulation. IfFALSE
only the end network is saved.- verbose
TRUE/FALSE. If set to true it shows the iteration steps and some results.
- parallel
Boolean. TRUE/FALSE.
Value
If chain=FALSE
a list
(of length nsims
) of adjacency matrices
representing the final network after the simulated evolution. If
chain=TRUE
a list
of lists of adjacency matrices. Each inner list
represents the complete network evolution of one simulation. The outer list
refers to the simulation run (with length nsims
).
Details
For examples on how to use ts_sims
see:
vignette("1.Introduction_RsienaTwoStep", package="RsienaTwoStep")
or the
package website. Before you
set parallel
to TRUE make sure to set-up a cluster with the package
doParallel
(see Examples
).
p2step==c(1,0,0)
: ministepp2step==c(0,1,0)
& dist1==NULL & dist2==NULL: twostep-simultaneityp2step==c(0,1,0)
& dist1!=NULL & dist2==NULL: twostep-strict coordinationp2step==c(0,1,0)
& dist1!=NULL & dist2!=NULL: twostep-weak coordinationp2step==c(0,0,1)
: two-ministeps
Examples
ts_sims(
net = ts_net2,
nsims = 2,
parallel = FALSE,
statistics = list(ts_degree, ts_recip),
startvalues = c(3, -2, 1),
p2step = c(0, 1, 0)
)
#> [1] "nsim: 1"
#> [1] "nsim: 2"
#> [[1]]
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0 0 0 0 0
#> [2,] 0 0 0 0 0
#> [3,] 0 0 0 0 0
#> [4,] 1 0 0 0 0
#> [5,] 0 0 0 0 0
#>
#> [[2]]
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0 0 1 0 0
#> [2,] 1 0 0 0 0
#> [3,] 0 0 0 0 0
#> [4,] 0 0 0 0 0
#> [5,] 0 0 0 0 0
#>