Skip to contents

These functions calculate characteristics of the simulated networks.

Usage

ts_dyads(sims, simtype = "notypespecified", forplot = TRUE)

ts_triads(sims, simtype = "notypespecified", forplot = TRUE)

ts_nacf(sims, simtype = "notypespecified", forplot = TRUE, cov)

ts_degreecount(sims, mode = "out", simtype = "notypespecified", forplot = TRUE)

ts_rsienanets(ans)

Arguments

sims

list, a list of (simulated) networks, the adjacency matrices representing the relations between actors. Valid values are 0 and 1. These simulated networks can be saved in objects that result from running ts_sims(), ts_estim() or RSiena::siena07().

simtype

string, name of the simulation type used (e.g. ministep, twostep).

forplot

logical, if set to FALSE a dataframe is returned with in the column the network characteristic and each row represents a simulation outcome. If set to TRUE this dataframe is manipulated a bit, so that each row represents one specific network characteristic for each simulation outcome, this is useful for plotting.

cov

numeric, covariate scores

mode

Character string, “out” for out-degree, “in” for in-degree or “total” for the sum of the two. “all” is a synonym of “total”.

ans

Results of class sienaFit, produced by a call to RSiena::siena07()

Value

data.frame

Details

For examples on how to use these statistics see: vignette("Introduction_RsienaTwoStep").

Examples

if (FALSE) {
results_ministep <- ts_sims(net=net1, rate=5, statistics=list(ts_degree, ts_recip),
parameters=c(-3,1))
results_twostep <- ts_sims(net=net1, rate=5, statistics=list(ts_degree, ts_recip),
parameters=c(-3,1), p2step=1)

dts_ms <- ts_dyads(sims=results_ministep, simtype="ministep")
dts_ts <- ts_dyads(sims=results_twostep, simtype="twostep")

df <- rbind(dts_ms, dts_ts)
p <- ggplot(df, aes(x=x, y=y, fill=type)) +
 geom_violin(position=position_dodge(1)) +
 stat_summary(fun = mean,
              geom = "errorbar",
              fun.max = function(x) mean(x) + sd(x),
              fun.min = function(x) mean(x) - sd(x),
              width=.1,
              color="red", position=position_dodge(1)) +
 stat_summary(fun = mean,
              geom = "point",
              color="red", position=position_dodge(1))

p
}