Outputs a vector of mean ages of edges at a series of timesteps
If not passing
This function calculates the mean partnership age at each time step over
a dynamic network simulation from
netest. These objects
contain the network, edgelist, and dissolution objects needed for the
calculation. Alternatively, one may pass in these objects separately if
netest was not used, or statistics were not run requested after
Currently, the calculations are limited to those dissolution formulas with a
single homogenous dissolution (
~offset(edges)). This functionality
will be expanded in future releases.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# Initialize and parameterize the network model nw <- network_initialize(n = 100) formation <- ~edges target.stats <- 50 coef.diss <- dissolution_coefs(dissolution = ~offset(edges), duration = 20) # Model estimation est <- netest(nw, formation, target.stats, coef.diss, verbose = FALSE) # Simulate the network and extract a timed edgelist dx <- netdx(est, nsims = 1, nsteps = 100, keep.tedgelist = TRUE, verbose = FALSE) el <- as.data.frame(dx) # Calculate ages directly from edgelist mean_ages <- edgelist_meanage(el = el) mean_ages # Alternatively, netdx calculates these dx$pages identical(dx$pages[], mean_ages)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.