% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/vertex_bootstrap.R
\name{vertex_compare}
\alias{vertex_compare}
\title{Compare Network-Level Statistics of Two Networks}
\usage{
vertex_compare(
  x,
  y,
  iter = 1000L,
  ci_level = 0.05,
  statistics = NULL,
  statistic_fn = NULL,
  directed = NULL,
  seed = NULL,
  labels = c("x", "y")
)
}
\arguments{
\item{x, y}{The two networks: \code{netobject}s, \code{cograph_network}s,
square weight matrices, or precomputed \code{net_vertex_bootstrap}
objects (then \code{iter}, \code{statistics}, \code{statistic_fn},
\code{directed}, and \code{seed} are ignored for that argument).
The two sides must cover exactly the same statistics; a mismatch
(e.g., a directed network's \code{reciprocity} against an undirected
one, or precomputed objects built with different \code{statistics}
selections) is an error, never a silent subset.}

\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{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.}

\item{labels}{Character vector of length 2 naming the networks in the
output (default \code{c("x", "y")}).}
}
\value{
An object of class \code{"net_vertex_comparison"} containing:
\describe{
\item{summary}{Tidy data frame, one row per statistic:
\code{statistic}, the two observed values, \code{diff},
\code{se_diff}, \code{z}, \code{p_value}, and a normal-approximation
confidence interval for the difference.}
\item{x, y}{The two \code{net_vertex_bootstrap} results.}
\item{labels, ci_level}{Configuration.}
}
When both bootstrap SEs are zero (a statistic with no resampling
variation in either network) \code{z} and \code{p_value} are \code{NA}.
}
\description{
Snijders & Borgatti (1999) two-network test: each network's statistics
get vertex-bootstrap standard errors, and each difference is tested with
\deqn{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.
}
\examples{
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

}
\references{
Snijders, T. A. B., & Borgatti, S. P. (1999). Non-parametric standard
errors and tests for network statistics. \emph{Connections}, 22(2),
161-170.
}
\seealso{
\code{\link{vertex_bootstrap}}, \code{\link{nct}} for the
permutation-based comparison of edge-level structure when raw data
are available, \code{\link{permutation}}.
}
