gof_bigergm {bigergm}R Documentation

Goodness of fit statistics for HERGM

Description

Goodness of fit statistics for HERGM

Usage

gof_bigergm(
  net,
  data_for_simulation,
  list_feature_matrices,
  colname_vertex_id,
  colname_block_membership,
  bigergm_results,
  type = "full",
  ergm_control = ergm::control.simulate.formula(),
  seed = NULL,
  n_sim = 1,
  prevent_duplicate = TRUE,
  compute_geodesic_distance = FALSE,
  start_from_observed = FALSE,
  ...
)

Arguments

net

the target network

data_for_simulation

a dataframe with node-level covariates

list_feature_matrices

a list of feature adjacency matrices

colname_vertex_id

the name of the column that contains the node id

colname_block_membership

the name o the column that contains the block affiliation of each node

bigergm_results

a bigergm results object

type

the type of evaluation to perform. Can take the values full or within. full performs the evaluation on all edges, and within only considers within-block edges.

ergm_control

MCMC parameters as an instance of ergm.control

seed

the seed to be passed to simulate_hergm

n_sim

the number of simulations to employ for calculating goodness of fit

prevent_duplicate

see simulate_hergm

compute_geodesic_distance

if TRUE, the distribution of geodesic distances is also computed (considerably increases computation time on large networks. FALSE by default.)

start_from_observed

if TRUE, MCMC uses the observed network as a starting point

...

Additional arguments, to be passed to lower-level functions

Value

gof_bigergm returns a list with two entries. The first entry 'original' is another list of the network stats, degree distribution, edgewise-shared partner distribution, and geodesic distance distribution (if compute_geodesic_distance = TRUE) of the observed network. The second entry is called 'simulated' is also list compiling the network stats, degree distribution, edgewise-shared partner distribution, and geodesic distance distribution (if compute_geodesic_distance = TRUE) of all simulated networks.

Examples

data(toyNet)

# Specify the model that you would like to estimate.
model_formula <- toyNet ~ edges + nodematch("x") + nodematch("y") + triangle
# Estimate the model
nodes_data <- data.frame(
  node_id = 1:toyNet$gal$n,
  x = toyNet %v% "x",
  y = toyNet %v% "y",
  block = toyNet %v% "block"
)
list_feature_matrices <- bigergm::get_list_sparse_feature_adjmat(toyNet, model_formula)
estimate <- hergm(model_formula,n_clusters = 4)
gof_res <- bigergm::gof_bigergm(
  toyNet,
  list_feature_matrices = list_feature_matrices,
  data_for_simulation = nodes_data,
  colname_vertex_id = "node_id",
  colname_block_membership = "block",
  bigergm_results = estimate,
  n_sim = 100
)



[Package bigergm version 1.1.0 Index]