Learn R Programming

ergm (version 3.1.3)

network.update: Replaces the sociomatrix in a network object

Description

Replaces the sociomatrix in a network object with the sociomatrix specified by newmatrix. See ergm for more information.

Usage

network.update(nw, newmatrix, matrix.type=NULL, output="network")

Arguments

nw
a network object. See documentation for the network package.
newmatrix
Either an adjacency matrix (a matrix of zeros and ones indicating the presence of a tie from i to j) or an edgelist (a two-column matrix listing origin and destination node numbers for each edge; note that in an undirected matrix, the first column sh
matrix.type
One of "adjacency" or "edgelist" telling which type of matrix newmatrix is. Default is to use the which.matrix.type function.
output
Currently unused.

Value

See Also

ergm, network

Examples

Run this code
#
data(florentine)
#
# test the network.update function
#
# Create a Bernoulli network
rand.net <- network(network.size(flomarriage))
# store the sociomatrix 
rand.mat <- rand.net[,]
# Update the network
network.update(flomarriage, rand.mat, matrix.type="adjacency")
# Try this with an edgelist
rand.mat <- as.matrix.network.edgelist(flomarriage)[1:5,]
network.update(flomarriage, rand.mat, matrix.type="edgelist")

Run the code above in your browser using DataLab