% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/compare_network.R
\name{compare_model}
\alias{compare_model}
\alias{compare_model.netobject}
\alias{compare_model.cograph_network}
\alias{compare_model.matrix}
\title{Compare two networks descriptively}
\usage{
compare_model(x, ...)

\method{compare_model}{netobject}(
  x,
  y,
  scaling = "none",
  measures = character(0),
  network = TRUE,
  ...
)

\method{compare_model}{cograph_network}(
  x,
  y,
  scaling = "none",
  measures = character(0),
  network = TRUE,
  ...
)

\method{compare_model}{matrix}(
  x,
  y,
  scaling = "none",
  measures = character(0),
  network = TRUE,
  ...
)
}
\arguments{
\item{x}{A \code{netobject}, \code{cograph_network}, or numeric square matrix.}

\item{...}{Ignored.}

\item{y}{A \code{netobject}, \code{cograph_network}, or numeric square matrix.}

\item{scaling}{Scaling applied to both weight matrices before comparison.
One of:
\describe{
\item{\code{"none"}}{Identity (default).}
\item{\code{"minmax"}}{\eqn{(w - \min) / (\max - \min)}; maps to \eqn{[0, 1]}.}
\item{\code{"max"}}{\eqn{w / \max(|w|)}; preserves sign.}
\item{\code{"rank"}}{Min-max of average ranks; ordinal scaling.}
\item{\code{"zscore"}}{\eqn{(w - \bar w) / s_w}; standard score.}
\item{\code{"robust"}}{\eqn{(w - \mathrm{med}(w)) / \mathrm{mad}(w)};
Huber-style robust z-score, resists outliers.}
\item{\code{"log"}}{\eqn{\log(w)}; requires \eqn{w > 0}.}
\item{\code{"log1p"}}{\eqn{\log(1 + w)}; admits \eqn{w \ge 0}.}
\item{\code{"softmax"}}{Numerically stable softmax over the flattened
vector.}
\item{\code{"quantile"}}{Empirical CDF of the flattened vector.}
\item{\code{"frobenius"}}{Divide the matrix by its Frobenius norm
\eqn{\|W\|_F = \sqrt{\sum w_{ij}^2}}; matrix-level normalisation.}
\item{\code{"row"}}{Row-stochastic normalisation (each row's absolute
values sum to 1). Only meaningful for non-negative matrices; rows
summing to zero are left unchanged.}
}
Scalings that produce negative weights (\code{zscore}, \code{robust}) are
compatible with \code{network = TRUE} because the side-by-side metrics use
Nestimate's base-R Floyd-Warshall, which handles negative weights.}

\item{measures}{Character vector of centrality measures to compare. Empty
by default (no centrality block). Valid names are \code{"InStrength"},
\code{"OutStrength"}, and \code{"Betweenness"}. Unknown names are
ignored with a warning.}

\item{network}{Logical. Include side-by-side network metrics from
\code{summary()}? Default \code{TRUE}.}
}
\value{
A \code{net_comparison} object: a named list with \code{matrices},
\code{difference_matrix}, \code{edge_metrics}, \code{summary_metrics}, optionally
\code{network_metrics}, \code{centrality_differences}, \code{centrality_correlations}.
}
\description{
Computes a battery of descriptive comparison metrics between two networks
or two weight matrices: weight deviations (mean / median / RMS / max
absolute difference, relative mean absolute difference, coefficient-of-
variation ratio), four correlation measures (Pearson, Spearman, Kendall,
distance correlation), five dissimilarity measures (Euclidean, Manhattan,
Canberra, Bray-Curtis, Frobenius), five similarity measures (Cosine,
Jaccard, Dice, Overlap, RV), pattern agreements, and side-by-side network
metrics. Optionally adds centrality differences and centrality
correlations.
}
\details{
Mirrors \code{tna::compare()} numerically. Inputs are converted to weight
matrices and scaled before comparison; the choice of scaling determines
how weights from different estimators are placed on a common footing.
}
