% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/backbone.R
\name{backbone}
\alias{backbone}
\title{Extract network backbone using the disparity filter}
\usage{
backbone(edges, alpha = 0.05)
}
\arguments{
\item{edges}{A data frame with at least columns \code{from}, \code{to}, and \code{weight}.
Must be an undirected edge list (each pair appears once).}

\item{alpha}{Numeric. Significance threshold in (0, 1). Default \code{0.05}.}
}
\value{
The filtered edge data frame with an added \code{alpha} column (the
minimum alpha from the two endpoints).
}
\description{
Applies the disparity filter to a weighted edge list. For each edge, it
computes an alpha (p-value) from both endpoints and keeps the edge if it
is statistically significant from at least one endpoint.
}
\details{
The null model asks: given that node \eqn{i} has total strength \eqn{s_i}
distributed uniformly across \eqn{k_i} edges, what is the probability that
a single edge weight is as large as \eqn{w_{ij}}? The answer is
\deqn{\alpha_{ij} = \left(1 - \frac{w_{ij}}{s_i}\right)^{k_i - 1}}

An edge is retained if \eqn{\min(\alpha_{ij}, \alpha_{ji}) < \alpha}.
Nodes with only one edge always have \eqn{\alpha = 0} and are always kept.
}
\examples{
edges <- data.frame(
  from   = c("A", "A", "A", "B", "C"),
  to     = c("B", "C", "D", "C", "D"),
  weight = c(10,   1,   1,   8,   1)
)
backbone(edges, alpha = 0.05)
}
