View source: R/vertex_bootstrap.R
| vertex_bootstrap | R Documentation |
Non-parametric vertex bootstrap of a single observed network (Snijders & Borgatti 1999). Vertices are resampled with replacement and the weight matrix is rebuilt from the original entries of the resampled vertex pairs; network-level statistics computed on each replicate give bootstrap distributions, standard errors, and confidence intervals.
Unlike bootstrap_network, which resamples the underlying
cases (sequences or rows) and therefore requires the raw data stored in
the netobject, the vertex bootstrap needs only the weight
matrix. It works on any netobject - including data-less ones
such as build_mlvar constituents or as_tna(mcml)
elements - and on plain weight matrices. The two procedures answer
different questions: the case bootstrap quantifies sampling-of-subjects
uncertainty in the edge weights; the vertex bootstrap quantifies
structural uncertainty of whole-network descriptives given the one
network you observed.
vertex_bootstrap(
x,
iter = 1000L,
ci_level = 0.05,
ci_method = c("percentile", "basic"),
statistics = NULL,
statistic_fn = NULL,
directed = NULL,
seed = NULL
)
x |
A |
iter |
Integer. Number of bootstrap replicates (default 1000). |
ci_level |
Numeric. Significance level for the confidence intervals (default 0.05 for 95% CIs). |
ci_method |
Character. |
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. |
Each replicate draws n vertex indices with replacement and sets
W_b[i, j] = W[idx_i, idx_j]. When the same original vertex is
drawn for two different positions, the off-diagonal cell would be a
structural self-pair; following Snijders & Borgatti, such cells are
filled with the weight of a randomly chosen pair of distinct original
vertices. Diagonal entries carry the original self-weight of the
resampled vertex (W[idx_i, idx_i]) - self-loops are meaningful
in transition networks and are never altered. For undirected networks
the substitution is applied symmetrically so replicates stay symmetric.
Built-in statistics (all computed on the off-diagonal part of the weight matrix):
densityProportion of non-zero off-diagonal cells.
mean_weightMean of the non-zero off-diagonal weights.
centralizationFreeman-type strength centralization:
sum(max(s) - s) / ((n - 1) * max(s)) where s is total
node strength on absolute weights. 0 when all nodes have equal
strength, approaching 1 for a star.
reciprocityDirected networks only. Weighted
reciprocity sum(pmin(|W|, |t(W)|)) / sum(|W|) over
off-diagonal cells: the proportion of total weight that is
reciprocated.
An object of class "net_vertex_bootstrap" containing:
Tidy data frame, one row per statistic: statistic,
observed, boot_mean, boot_sd, bias,
ci_lower, ci_upper.
iter x n_statistics matrix of replicate values.
Named vector of observed statistics.
Configuration.
Snijders, T. A. B., & Borgatti, S. P. (1999). Non-parametric standard errors and tests for network statistics. Connections, 22(2), 161-170.
Davison, A. C., & Hinkley, D. V. (1997). Bootstrap Methods and their Application. Cambridge University Press.
bootstrap_network for case-resampling edge-weight
inference, centrality_stability for case-dropping
centrality stability.
seqs <- data.frame(
T1 = c("plan", "code", "debug", "plan", "test", "code"),
T2 = c("code", "debug", "code", "plan", "code", "test"),
T3 = c("debug", "code", "plan", "code", "debug", "plan"),
T4 = c("test", "plan", "test", "debug", "plan", "code")
)
net <- build_network(seqs, method = "relative")
vb <- vertex_bootstrap(net, iter = 100, seed = 1)
vb$summary
plot(vb)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.