Description Usage Arguments Details Value See Also Examples
The method simulate.sisnetwork
simulates graphs with the same marginals as the passed network or as the rows and columns specified in a sisnetwork
object through sequential importance sampling. That is, the degrees of the nodes are fixed and specified.
1 2 |
object |
Either a |
nsim |
Number of networks to be randomly drawn from the set of all networks. |
seed |
Seed for random number generator. |
save.networks |
If this is |
... |
Further arguments passed to or used by methods. |
A sample of networks is randomly drawn from the space of networks with the same degrees for each node.
simulate.sisnetwork
returns an object of class network.series
, that is a list consisting of the following elements:
networks |
The vector of simulated networks. |
log.prob |
The vector of the logarithm of the probability of being sampled. |
log.graphspace.size |
The logarithm of the mean estimate of the number of graphs in the graph space. |
log.graphspace.SE |
The logarithm of the standard error of the mean estimate of the number of graphs in the graph space. |
log.graphspace.size.lne |
The logarithm of the lognormal-based estimate of the number of graphs in the graph space. |
log.graphspace.SE.lne |
The logarithm of the standard error of the lognormal-based estimate of the number of graphs in the graph space. |
network
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | bipartite.graph <- matrix(c(1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0), nrow = 3, byrow = TRUE)
example.net <- network(bipartite.graph)
# Specify the set to which each node belongs
example.net %v% "set" <- c(rep(1, 3),rep(2, 4))
# Simulate 100 graphs with the same marginals as 'example.net'
sim <- simulate.sisnetwork(example.net, nsim = 100)
# Estimated graph space size and SE
exp(sim$log.graphspace.size)
exp(sim$log.graphspace.SE)
# Darwin's finches example
data(finch)
sim <- simulate.sisnetwork(finch, nsim = 100, save.networks = TRUE)
# Calculate importance weights from the graph probabilities
importance.weights <- 1 / exp(sim$log.prob)
hist(importance.weights, breaks = 25, xlab = "Inverse Graph Probability", main="")
# Calculate Sanderson's \bar{S}^2
s.bar.squared.vec <- rep(0, 100)
for(i in 1 : 100)
{
# Extract simulated bipartite graphs
new.graph <- as.matrix.network(sim$networks[[i]])
# Calculate custom graph statistic
s.bar.squared.vec[i] <- (sum((new.graph %*% t(new.graph)) ^ 2) -
sum(diag((new.graph %*% t(new.graph)) ^ 2))) / (13 * 12)
}
|
Loading required package: network
network: Classes for Relational Data
Version 1.13.0.1 created on 2015-08-31.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
Mark S. Handcock, University of California -- Los Angeles
David R. Hunter, Penn State University
Martina Morris, University of Washington
Skye Bender-deMoll, University of Washington
For citation information, type citation("network").
Type help("network-package") to get started.
networksis: Simulate Bipartite Graphs with Fixed Marginals Through
Sequential Importance Sampling
Version 2.1-3 created on 2015-04-07.
copyright (c) 2008, Ryan Admiraal, Murdoch University
Based on "statnet" project software (statnet.org).
For license and citation information see statnet.org/attribution
For citation information, type citation("networksis").
Type help("networksis-package") to get started.
[1] 11.585
[1] 0.1626881
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.