ergm_block_diag_samp_info function

Compute and serialize information needed by the block-diagonal Metropolis-Hastings samplers.

Compute and serialize information needed by the block-diagonal Metropolis-Hastings samplers.

Given a nodal attribute vector specifying the blocks returns a list containing information needed to efficiently sample dyads in those blocks.

ergm_block_diag_samp_info(nw, a)

Arguments

  • nw: the network of interest.
  • a: either a vector (of any mode) whose iith element identifies the block to which vertex ii belongs. Blocks must be continguous.

Returns

An object of nonce class ergm_block_diag_samp_info with the following elements at this time:

  • nblk: number of blocks

  • pos (for unipartite), b1pos and b2pos (for bipartite): vectors of length nblk+1 such that (pos[i]+1):(pos[i+1]) are the numbers of the vertices in block i.

  • cumwt: vector of length nblk with values such that generating U Uniform(0,1)U ~ Uniform(0,1)

     selecting the index of the first element in `cumwt` that is greater than $U$ will sample from the blocks in proportion to the number of dyads in the block.
    

In addition, an attribute "ndyads" is attached, containing the total number of dyads in all blocks put together.

  • Maintainer: Pavel N. Krivitsky
  • License: GPL-3 + file LICENSE
  • Last published: 2024-11-05