
Last chance! 50% off unlimited learning
Sale ends in
Simulates a network with various structures.
rNetwork(p,
pi,
alpha = c(1),
directed = FALSE,
name = "a network",
signed = TRUE)
the number of nodes of the simulated network.
a matrix of cluster connectivity (see details).
a vector of cluster proportions.
a logical indicating the directedness of the network.
a character string indicating the name of the network.
a logical indicating whether partial correlations should be signed or all kept positive.
Returns an object of class simone.network
, that is, a list
comprising
the directed
is FALSE
.
a Theta
contains the parameters of a
VAR(1) model; if undirected, Theta
is the concentration
matrix (inverse of the covariance matrix) of a Gaussian vector
a logicial indicating the directedness of the network.
a size-pi
: the levels are labeled
a character string containing the name of the network.
Matrix pi
should be a square matrix of the same size as vector
alpha
. When the network is not directed, pi
should be
symmetric. When the graph is directed, entry
_ql corresponds to
edges heading from class
Entries of pi
can be either integers or real numbers. If they are
integers, they are considered as the exact number of edges required from
one class to another. Otherwise, they are considered as connectivity
probabilities between classes. They should therefore sum up to at most
1. If they do not sum up to one excatly, the remaining value is
considered as the probability for a node to belong to the dust class
(connected to no other node).
# NOT RUN {
## generate an Erdos-Renyi network with 50 nodes and Pr of edges = 0.1
plot(rNetwork(p = 50, pi = 0.1, name = "an Erdos-Renyi network"))
## generate an network with 15 nodes and 25 randomly selected edges
plot(rNetwork(p = 15, pi = 25, name = "a 25 edges network"))
## generate an undirected network with an affiliation structure
PI <- matrix(c(15,2,2,50),2,2)
alpha <- c(1/3,2/3)
plot(rNetwork(p = 20, pi = PI, alpha = alpha,
name = "Affiliation, fixed num of edges"))
## generate a directed network with hubs
PI <- t(matrix(c(0.2,0.1,0.4,0,0.05,0.15,0,0.4,rep(0,8)),4,4))
alpha <- c(1/20,1/20,9/20,9/20)
plot(rNetwork(p = 55, pi = PI, alpha = alpha, directed = TRUE,
name = "Hubs structured network"))
# }
Run the code above in your browser using DataLab