Learn R Programming

EpiModel (version 2.0.1)

netdx: Dynamic Network Model Diagnostics

Description

Runs dynamic diagnostics on an ERGM/STERGM estimated through netest.

Usage

netdx(
  x,
  nsims = 1,
  dynamic = TRUE,
  nsteps,
  nwstats.formula = "formation",
  set.control.ergm,
  set.control.stergm,
  sequential = TRUE,
  keep.tedgelist = FALSE,
  keep.tnetwork = FALSE,
  verbose = TRUE,
  ncores = 1,
  skip.dissolution = FALSE
)

Control Arguments

Models fit with the full STERGM method in netest (setting edapprox argument to FALSE) require only a call to simulate.stergm. Control parameters for those simulations may be set using set.control.stergm in netdx. The parameters should be input through the control.simulate.stergm() function, with the available parameters listed in the control.simulate.stergm help page in the tergm package.

Models fit with the ERGM method with the edges dissolution approximation (setting edapprox to TRUE) require a call first to simulate.ergm for simulating an initial network, and second to simulate.network for simulating that static network forward through time. Control parameters may be set for both processes in netdx. For the first, the parameters should be input through the control.simulate.ergm() function, with the available parameters listed in the control.simulate.ergm help page in the ergm package. For the second, parameters should be input through the control.simulate.network() function, with the available parameters listed in the control.simulate.network help page in the tergm package. An example is shown below.

Details

The netdx function handles dynamic network diagnostics for network models fit with the netest function. Given the fitted model, netdx simulates a specified number of dynamic networks for a specified number of time steps per simulation. The network statistics in nwstats.formula are saved for each time step. Summary statistics for the formation model terms, as well as dissolution model and relational duration statistics, are then calculated and can be accessed when printing or plotting the netdx object.

See Also

Plot these model diagnostics with plot.netdx.

Examples

Run this code
# NOT RUN {
# Network initialization and model parameterization
nw <- network_initialize(n = 100)
formation <- ~edges
target.stats <- 50
coef.diss <- dissolution_coefs(dissolution = ~offset(edges), duration = 25)

# Estimate the model
est <- netest(nw, formation, target.stats, coef.diss, verbose = FALSE)

# Static diagnostics on the ERGM fit
dx1 <- netdx(est, nsims = 1e4, dynamic = FALSE,
             nwstats.formula = ~edges + meandeg + concurrent)
dx1
plot(dx1, method = "b", stats = c("edges", "concurrent"))

# Dynamic diagnostics on the STERGM approximation
dx2 <- netdx(est, nsims = 5, nsteps = 500,
             nwstats.formula = ~edges + meandeg + concurrent,
             set.control.ergm = control.simulate.ergm(MCMC.burnin = 1e6))
dx2
plot(dx2, stats = c("edges", "meandeg"), plots.joined = FALSE)
plot(dx2, type = "duration")
plot(dx2, type = "dissolution", qnts.col = "orange2")
plot(dx2, type = "dissolution", method = "b", col = "bisque")
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab