Learn R Programming

blkergm (version 1.1)

blkergm-terms: The terms for the ERGM package for fitting models with block structures

Description

This package contain R functions and terms used for fitting block ERGMs. Depending on different dependence and homogeneous assumptions on the model, the models include different terms. The package consider these assumptions and codes the terms using the "ergm.userterms" package to give an easy user interface to fit block models.The meaning and usage of these terms are listed below.

Arguments

Terms for the block ergms

blkedges(blockbdr,blockid)
The number of edges in a given block with blockid: Assume the rows and columns of the network adjacency matrix is ordered by which block they belong to. blockbdr argument is a vector specifying the boundary of blocks. For example, (5,12,17) specifies the boundary of blocks in the way that there are 3 blocks in this network and nodes 1-5 are in block 1, 6-12 are in block 2 and 13-17 are in block 3. blockid specifies the block which we want to retrieve the number of edges from. Take the above example, there are 3 blocks in that network,so that the number of between blocks is 3. They are block 1-2, block 1-3 and block 2-3. These blocks are ordered as 1,1-2,1-3,2,2-3,3. Then blkedges(c(5,12,17),blockid=3) means the number of edges in block 1-3 with block structure (5,12,17) explained above.
blktriangle(blockbdr,blockid)
The number of triangles in a given block with blockid: The blockbdr is the same as that in blkedges. This term aims to return the number of triangles in a given block with blockid. Different from the blockid in blkedges, it only computes the number of triangles within a block. In the above example, there are 3 blocks. The blockid only takes value of 1,2 and 3. More specifically, blktriangle((5,12,17),3) means the number of triangles in block 3 in this network.
blkkstar(k,blockbdr,blockid)
The number of k-stars in a given block with blockid: blockbdr and blockid are the same as in blktriangle.k can be a vector or scalor specifying "k"-stars. Note that, this term only return the number of k-stars within each block.
blktriangle2(blockbdr,blockid)
The number of triangles within each block with blockid and those formed by edges between this block and other blocks: blockid ranges from 1 to 3 in the above example.
blkkstar2(k,blockbdr,blockid)
The number of k-stars within each block with blockid and those formed by edges between this block and other blocks: k can be a vector or a scalor specifying "k"-stars. blockid ranges from 1 to 3 in the above example.
blkkstar3(k,blockbdr,blockid)
The number of k-stars formed by edges between two blocks blockid can only take values for those off diagonal blocks. In the above example, blockid can take 2,3 and 5.
degseq
Degree sequence of a given network The number of values returned by this term is equal to the number of nodes in the network. They correspond to the nodal degrees of all nodes.
blkdegseq(blockbdr,blockid)
The degree sequence in a given block with blockid: blockid ranges from 1-3 in the above example. Please add one more 0 in front of blockbdr vector to indicate the starting position of the first node.

References

Hunter DR, Goodreau SM, Handcock MS (2011) ergm.userterms: A Template Package for Extending statnet.

See Also

statnet, network, ergm, ergm-terms

Examples

Run this code
## Not run: 
# data(zachary)
# summary(zachary~degseq)
# summary(zachary~blkdegseq(c(0,16,34),1)+blkdegseq(c(0,16,34),2))
# summary(zachary~blkedges(c(16,34),1:3))
# summary(zachary~blktriangle(c(16,34),1:2))
# summary(zachary~blkkstar(1:3,c(16,34),1:2))
# summary(zachary~blktriangle2(c(16,34),1:2))
# summary(zachary~blkkstar2(1:3,c(16,34),1:2))
# summary(zachary~blkkstar3(1:3,c(16,34),2))
# ## End(Not run)

Run the code above in your browser using DataLab