% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nct.R
\name{nct}
\alias{nct}
\title{Network Comparison Test}
\usage{
nct(
  data1,
  data2,
  iter = 1000L,
  gamma = 0.5,
  paired = FALSE,
  abs = TRUE,
  weighted = TRUE,
  p_adjust = "none"
)
}
\arguments{
\item{data1}{A numeric matrix or data.frame of observations from group 1.}

\item{data2}{A numeric matrix or data.frame of observations from group 2.
Same number of columns as \code{data1}.}

\item{iter}{Integer. Number of permutation iterations. Default 1000.}

\item{gamma}{EBIC tuning parameter for glasso. Default 0.5.}

\item{paired}{Logical. If \code{TRUE}, perform a paired permutation
(within-subject swap). Default \code{FALSE}.}

\item{abs}{Logical. If \code{TRUE}, compute global strength on absolute
edge weights. Default \code{TRUE}.}

\item{weighted}{Logical. If \code{TRUE}, use weighted networks for the
tests. If \code{FALSE}, binarize before computing statistics.
Default \code{TRUE}.}

\item{p_adjust}{P-value adjustment method for the per-edge tests
(any method in \code{stats::p.adjust.methods}). Default \code{"none"}.}
}
\value{
A list of class \code{net_nct} with elements:
\describe{
\item{nw1, nw2}{Estimated weighted adjacency matrices.}
\item{M}{List with \code{observed}, \code{perm}, \code{p_value} for
the global strength test.}
\item{S}{Same structure for the maximum absolute edge difference.}
\item{E}{Same structure for per-edge tests.}
\item{n_iter}{Number of permutations.}
\item{paired}{Whether a paired test was used.}
}
}
\description{
Tests whether two networks estimated from independent samples differ at
three levels: \strong{global strength} (M-statistic), \strong{network
structure} (S-statistic, max absolute edge difference), and
\strong{individual edges} (E-statistic per edge). Inference is via
permutation of group labels.
}
\details{
Implementation matches \code{NetworkComparisonTest::NCT()} with defaults
\code{abs = TRUE}, \code{weighted = TRUE}, \code{paired = FALSE} at
machine precision when the same seed is used. The network estimator is
EBIC-selected glasso applied to a Pearson correlation matrix, with
\code{Matrix::nearPD} symmetrization (matching NCT's
\code{NCT_estimator_GGM} default).
}
\examples{
\dontrun{
set.seed(1)
x1 <- matrix(rnorm(200 * 5), 200, 5)
x2 <- matrix(rnorm(200 * 5), 200, 5)
colnames(x1) <- colnames(x2) <- paste0("V", 1:5)
res <- nct(x1, x2, iter = 100)
res$M$p_value
res$S$p_value
}
}
