Description Usage Arguments Details Value Examples
Calculates dissolution coefficients, given a dissolution model
and average edge duration, to pass as offsets to an ERGM/STERGM
model fit in netest
.
1  dissolution_coefs(dissolution, duration, d.rate = 0)

dissolution 
Righthand sided STERGM dissolution formula
(see 
duration 
A vector of mean edge durations in arbitrary time units. 
d.rate 
Departure or exit rate from the population, as a single homogenous rate that applies to the entire population. 
This function performs two calculations for dissolution coefficients
used in a network model estimated with netest
:
Transformation: the mean duration of edges in a network are mathematically transformed to logit coefficients.
Adjustment: in a dynamic network simulation in an open population (in which there are departures), it is further necessary to adjust these coefficients for dynamic simulations; this upward adjustment accounts for departure as a competing risk to edge dissolution.
The current dissolution models supported by this function and in network
model estimation in netest
are as follows:
~offset(edges)
: a homogeneous dissolution model in which the
edge duration is the same for all partnerships. This requires
specifying one duration value.
~offset(edges) + offset(nodematch("<attr>"))
: a heterogeneous
model in which the edge duration varies by whether the nodes in the
dyad have similar values of a specified attribute. The duration
vector should now contain two values: the first is the mean edge
duration of nonmatched dyads, and the second is the duration of the
matched dyads.
~offset(edges) + offset(nodemix("<attr>"))
: a heterogeneous
model that extends the nodematch model to include nonbinary
attributes for homophily. The duration vector should first contain
the base value, then the values for every other possible combination
in the term.
~offset(edges) + offset(nodefactor("<attr>"))
: a heterogeneous
model in which the edge duration varies by a specified attribute. The
duration vector should first contain the base value, then the values
for every other value of that attribute in the term.
A list of class disscoef
with the following elements:
dissolution: righthand sided STERGM dissolution formula passed in the function call.
duration: mean edge durations passed into the function.
coef.crude: mean durations transformed into logit coefficients.
coef.adj: crude coefficients adjusted for the risk of
departure on edge persistence, if the d.rate
argument is
supplied.
coef.form.corr: corrections to be subtracted from formation coefficients.
d.rate: the departure rate.
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 64 65 66 67 68 69 70 71 72  ## Homogeneous dissolution model with no departures
dissolution_coefs(dissolution = ~offset(edges), duration = 25)
## Homogeneous dissolution model with departures
dissolution_coefs(dissolution = ~offset(edges), duration = 25,
d.rate = 0.001)
## Heterogeneous dissolution model in which samerace edges have
## shorter duration compared to mixedrace edges, with no departures
dissolution_coefs(dissolution = ~offset(edges) + offset(nodematch("race")),
duration = c(20, 10))
## Heterogeneous dissolution model in which samerace edges have
## shorter duration compared to mixedrace edges, with departures
dissolution_coefs(dissolution = ~offset(edges) + offset(nodematch("race")),
duration = c(20, 10), d.rate = 0.001)
## Not run:
## Extended example for differential homophily by age group
# Set up the network with nodes categorized into 5 age groups
nw < network_initialize(n = 1000)
age.grp < sample(1:5, 1000, TRUE)
nw < set_vertex_attribute(nw, "age.grp", age.grp)
# durations = nonmatched, age.grp1 & age.grp1, age.grp2 & age.grp2, ...
# TERGM will include differential homophily by age group with nodematch term
# Target stats for the formation model are overall edges, and then the number
# matched within age.grp 1, age.grp 2, ..., age.grp 5
form < ~edges + nodematch("age.grp", diff = TRUE)
target.stats < c(450, 100, 125, 40, 80, 100)
# Target stats for the dissolution model are duration of nonmatched edges,
# then duration of edges matched within age.grp 1, age.grp 2, ..., age.grp 5
durs < c(60, 30, 80, 100, 125, 160)
diss < dissolution_coefs(~offset(edges) +
offset(nodematch("age.grp", diff = TRUE)),
duration = durs)
# Fit the TERGM
fit < netest(nw, form, target.stats, diss)
# Full diagnostics to evaluate model fit
dx < netdx(fit, nsims = 10, ncores = 4, nsteps = 300)
print(dx)
# Simulate one long time series to examine timed edgelist
dx < netdx(fit, nsims = 1, nsteps = 5000, keep.tedgelist = TRUE)
# Extract timededgelist
te < as.data.frame(dx)
head(te)
# Limit to noncensored edges
te < te[which(te$onset.censored == FALSE & te$terminus.censored == FALSE),
c("head", "tail", "duration")]
head(te)
# Look up the age group of head and tail nodes
te$ag.head < age.grp[te$head]
te$ag.tail < age.grp[te$tail]
head(te)
# Recover average edge durations for agegroup pairing
mean(te$duration[te$ag.head != te$ag.tail])
mean(te$duration[te$ag.head == 1 & te$ag.tail == 1])
mean(te$duration[te$ag.head == 2 & te$ag.tail == 2])
mean(te$duration[te$ag.head == 3 & te$ag.tail == 3])
mean(te$duration[te$ag.head == 4 & te$ag.tail == 4])
mean(te$duration[te$ag.head == 5 & te$ag.tail == 5])
durs
## End(Not run)

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