% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vertex_bootstrap.R
\name{vertex_bootstrap}
\alias{vertex_bootstrap}
\title{Vertex Bootstrap for Network-Level Statistics}
\usage{
vertex_bootstrap(
  x,
  iter = 1000L,
  ci_level = 0.05,
  ci_method = c("percentile", "basic"),
  statistics = NULL,
  statistic_fn = NULL,
  directed = NULL,
  seed = NULL
)
}
\arguments{
\item{x}{A \code{netobject} (from \code{\link{build_network}} or any
builder), a \code{cograph_network}, or a square numeric weight matrix.}

\item{iter}{Integer. Number of bootstrap replicates (default 1000).}

\item{ci_level}{Numeric. Significance level for the confidence
intervals (default 0.05 for 95\% CIs).}

\item{ci_method}{Character. \code{"percentile"} (default) for empirical
quantile intervals, or \code{"basic"} for intervals reflected around
the observed value (Davison & Hinkley 1997, eq. 5.6).}

\item{statistics}{Character vector selecting built-in statistics
(see Details). Default: all applicable to the network's directedness.}

\item{statistic_fn}{Optional named list of functions, each taking the
weight matrix and returning a single numeric value. Computed alongside
the built-ins.}

\item{directed}{Logical or NULL. Directedness of the network. NULL
(default) reads \code{x$directed} when available, otherwise falls
back to matrix symmetry.}

\item{seed}{Integer or NULL. RNG seed for reproducibility.}
}
\value{
An object of class \code{"net_vertex_bootstrap"} containing:
\describe{
\item{summary}{Tidy data frame, one row per statistic: \code{statistic},
\code{observed}, \code{boot_mean}, \code{boot_sd}, \code{bias},
\code{ci_lower}, \code{ci_upper}.}
\item{boot_stats}{\code{iter} x n_statistics matrix of replicate values.}
\item{observed}{Named vector of observed statistics.}
\item{iter, ci_level, ci_method, directed, n_nodes}{Configuration.}
}
}
\description{
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 \code{\link{bootstrap_network}}, which resamples the underlying
cases (sequences or rows) and therefore requires the raw data stored in
the netobject, the vertex bootstrap needs \strong{only the weight
matrix}. It works on any \code{netobject} - including data-less ones
such as \code{\link{build_mlvar}} constituents or \code{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.
}
\details{
Each replicate draws \code{n} vertex indices with replacement and sets
\code{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 (\code{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):
\describe{
\item{\code{density}}{Proportion of non-zero off-diagonal cells.}
\item{\code{mean_weight}}{Mean of the non-zero off-diagonal weights.}
\item{\code{centralization}}{Freeman-type strength centralization:
\code{sum(max(s) - s) / ((n - 1) * max(s))} where \code{s} is total
node strength on absolute weights. 0 when all nodes have equal
strength, approaching 1 for a star.}
\item{\code{reciprocity}}{Directed networks only. Weighted
reciprocity \code{sum(pmin(|W|, |t(W)|)) / sum(|W|)} over
off-diagonal cells: the proportion of total weight that is
reciprocated.}
}
}
\examples{
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
\donttest{
plot(vb)
}

}
\references{
Snijders, T. A. B., & Borgatti, S. P. (1999). Non-parametric standard
errors and tests for network statistics. \emph{Connections}, 22(2),
161-170.

Davison, A. C., & Hinkley, D. V. (1997). \emph{Bootstrap Methods and
their Application}. Cambridge University Press.
}
\seealso{
\code{\link{bootstrap_network}} for case-resampling edge-weight
inference, \code{\link{centrality_stability}} for case-dropping
centrality stability.
}
