View source: R/vertex_bootstrap.R
| vertex_compare | R Documentation |
Snijders & Borgatti (1999) two-network test: each network's statistics get vertex-bootstrap standard errors, and each difference is tested with
z = (\hat{\theta}_x - \hat{\theta}_y) /
\sqrt{SE_x^2 + SE_y^2}
against a standard normal reference. This is the comparison the vertex bootstrap was originally proposed for: deciding whether two observed networks differ in density, centralization, reciprocity, or any other whole-network descriptive.
vertex_compare(
x,
y,
iter = 1000L,
ci_level = 0.05,
statistics = NULL,
statistic_fn = NULL,
directed = NULL,
seed = NULL,
labels = c("x", "y")
)
x, y |
The two networks: |
iter |
Integer. Number of bootstrap replicates (default 1000). |
ci_level |
Numeric. Significance level for the confidence intervals (default 0.05 for 95% CIs). |
statistics |
Character vector selecting built-in statistics (see Details). Default: all applicable to the network's directedness. |
statistic_fn |
Optional named list of functions, each taking the weight matrix and returning a single numeric value. Computed alongside the built-ins. |
directed |
Logical or NULL. Directedness of the network. NULL
(default) reads |
seed |
Integer or NULL. RNG seed for reproducibility. |
labels |
Character vector of length 2 naming the networks in the
output (default |
An object of class "net_vertex_comparison" containing:
Tidy data frame, one row per statistic:
statistic, the two observed values, diff,
se_diff, z, p_value, and a normal-approximation
confidence interval for the difference.
The two net_vertex_bootstrap results.
Configuration.
When both bootstrap SEs are zero (a statistic with no resampling
variation in either network) z and p_value are NA.
Snijders, T. A. B., & Borgatti, S. P. (1999). Non-parametric standard errors and tests for network statistics. Connections, 22(2), 161-170.
vertex_bootstrap, nct for the
permutation-based comparison of edge-level structure when raw data
are available, permutation.
states <- c("plan", "code", "debug", "test")
s1 <- data.frame(
T1 = rep(states, 5), T2 = rep(rev(states), 5),
T3 = rep(states[c(2, 3, 4, 1)], 5)
)
s2 <- data.frame(
T1 = rep(states[c(3, 1, 4, 2)], 5), T2 = rep(states, 5),
T3 = rep(states[c(4, 3, 1, 2)], 5)
)
net1 <- build_network(s1, method = "relative")
net2 <- build_network(s2, method = "relative")
cmp <- vertex_compare(net1, net2, iter = 100, seed = 1)
cmp$summary
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.