ergm_block_diag_samp_info: Compute and serialize information needed by the...

View source: R/InitErgmProposal.blockdiag.R

ergm_block_diag_samp_infoR Documentation

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

Description

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

Usage

ergm_block_diag_samp_info(nw, a)

Arguments

nw

the network of interest.

a

either a vector (of any mode) whose ith element identifies the block to which vertex i belongs. Blocks must be continguous.

Value

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\sim \mathrm{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.


ergm.multi documentation built on May 29, 2024, 11:07 a.m.