as.network.numeric {ergm} | R Documentation |
as.network.numeric
creates a random Bernoulli network of the given size as an object of class network
.
## S3 method for class 'numeric' as.network(x, directed = TRUE, hyper = FALSE, loops = FALSE, multiple = FALSE, bipartite = FALSE, ignore.eval = TRUE, names.eval = NULL, edge.check = FALSE, density=NULL, theta0=NULL, numedges=NULL, ...)
x |
count; the number of nodes in the network. If |
directed |
logical; should edges be interpreted as directed? |
hyper |
logical; are hyperedges allowed? Currently ignored. |
loops |
logical; should loops be allowed? Currently ignored. |
multiple |
logical; are multiplex edges allowed? Currently ignored. |
bipartite |
count; should the network be interpreted as bipartite? If present (i.e., non-NULL) it is the count of the number of actors in the bipartite network. In this case, the number of nodes is equal to the number of actors plus the number of events (with all actors preceding all events). The edges are then interpreted as nondirected. |
ignore.eval |
logical; ignore edge values? Currently ignored. |
names.eval |
optionally, the name of the attribute in which edge values should be stored. Currently ignored. |
edge.check |
logical; perform consistency checks on new edges? |
density |
numeric; the probability of a tie for Bernoulli networks. If neither density nor theta0 are given, it defaults to the number of nodes divided by the number of dyads (so the expected number of ties is the same as the number of nodes.) |
theta0 |
numeric; the log-odds of a tie for Bernoulli networks. It is only used if density is not specified. |
numedges |
count; if present, sample the Bernoulli network conditional on this number of edges (rather than independently with the specified probability). |
... |
additional arguments |
The network will have not have vertex, edge or network attributes.
These can be added with operators such as %v%
, %n%
,
%e%
.
An object of class network
Butts, C.T. 2002. “Memory Structures for Relational Data in R: Classes and Interfaces” Working Paper.
#Draw a random directed network with 25 nodes g<-network(25) #Draw a random undirected network with density 0.1 g<-network(25, directed=FALSE, density=0.1) #Draw a random bipartite network with 10 events and 5 actors and density 0.1 g<-network(5, bipartite=10, density=0.1)