% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/casedrop_reliability.R
\name{casedrop_reliability}
\alias{casedrop_reliability}
\alias{print.net_casedrop_reliability}
\alias{summary.net_casedrop_reliability}
\alias{print.net_casedrop_reliability_group}
\alias{summary.net_casedrop_reliability_group}
\alias{print.summary.net_casedrop_reliability_group}
\alias{plot.net_casedrop_reliability}
\alias{plot.net_casedrop_reliability_group}
\title{Edge-weight Case-dropping Stability}
\usage{
casedrop_reliability(
  x,
  iter = 1000L,
  drop_prop = seq(0.1, 0.9, by = 0.1),
  threshold = 0.7,
  certainty = 0.95,
  method = c("spearman", "pearson", "kendall"),
  include_diag = FALSE,
  seed = NULL
)

\method{print}{net_casedrop_reliability}(x, digits = 3, ...)

\method{summary}{net_casedrop_reliability}(object, ...)

\method{print}{net_casedrop_reliability_group}(x, ...)

\method{summary}{net_casedrop_reliability_group}(object, drop_prop = NULL, ...)

\method{print}{summary.net_casedrop_reliability_group}(x, ...)

\method{plot}{net_casedrop_reliability}(x, combined = TRUE, ...)

\method{plot}{net_casedrop_reliability_group}(
  x,
  metric = c("correlation", "mean_abs_dev", "median_abs_dev", "max_abs_dev"),
  ...
)
}
\arguments{
\item{x}{A \code{net_casedrop_reliability_group} object.}

\item{iter}{Integer. Iterations per drop proportion. Default \code{1000}.}

\item{drop_prop}{Drop proportion at which to report the four metrics
(mean +/- sd per network). Must be one of the drop proportions the
object was built with. Defaults to the object's median grid value
(the stored grid is used, not an assumed \code{0.7}); pass an explicit
value not in the grid to get an error listing the available
proportions.}

\item{threshold}{Numeric in \verb{[0, 1]}. Minimum edge-vector correlation
for an iteration to count as stable. Default \code{0.7}.}

\item{certainty}{Numeric in \verb{[0, 1]}. Required fraction of iterations
whose correlation must exceed \code{threshold} for a drop proportion to
qualify. Default \code{0.95}.}

\item{method}{Correlation method: \code{"pearson"} (weight magnitudes),
\code{"spearman"} (ranks, robust to scale), or \code{"kendall"}. Default
\code{"spearman"} because edge weights often span several orders of
magnitude and rank stability is the typical target.}

\item{include_diag}{Logical. Include diagonal (self-loop) edges in the
edge vector. Default \code{FALSE}.}

\item{seed}{Optional integer for reproducibility.}

\item{digits}{Digits to display. Default \code{3}.}

\item{...}{Additional arguments (ignored).}

\item{object}{A \code{net_casedrop_reliability_group}.}

\item{combined}{When \code{TRUE} (default), all four metrics are shown in
one ggplot via \code{facet_wrap(~ metric)}. When \code{FALSE}, returns a named
list of four single-panel ggplots, one per metric.}

\item{metric}{Which metric to plot. One of \code{"correlation"}
(default), \code{"mean_abs_dev"}, \code{"median_abs_dev"}, \code{"max_abs_dev"}.}
}
\value{
An object of class \code{net_casedrop_reliability} with:
\describe{
\item{\code{cs}}{Scalar CS-coefficient - the maximum drop proportion for
which the edge-vector correlation remains >= \code{threshold} in at
least \code{certainty} of iterations. Zero if no proportion qualifies.}
\item{\code{correlations}}{\code{iter} x \code{length(drop_prop)} matrix of per-
iteration correlations.}
\item{\code{drop_prop}, \code{threshold}, \code{certainty}, \code{iter}, \code{method}}{Inputs.}
}

The input \code{x} invisibly.

A tidy data frame with columns \code{metric}, \code{drop_prop},
\code{mean}, \code{sd} summarising edge-weight stability across
case-dropping iterations.

A data frame with one row per network containing
\code{cor}, \code{mean_abs_dev}, \code{median_abs_dev}, \code{max_abs_dev} formatted as
"mean +/- sd".

A \code{ggplot} object, or a named list of four ggplots when
\code{combined = FALSE}.

A \code{ggplot} object.
}
\description{
Computes a \strong{CS-coefficient for the edge-weight vector} of a network:
the maximum proportion of cases (rows of \code{x$data}) that can be dropped
while the flattened edge-weight vector of the re-estimated network
still correlates with the original above \code{threshold} in at least
\code{certainty} of iterations.

Plots the four model-level reliability metrics across drop
proportions: \code{correlation}, \code{mean_abs_dev}, \code{median_abs_dev},
\code{max_abs_dev}. Each panel shows the per-iteration mean with a ribbon
at mean +/- sd. The \code{correlation} panel includes a dashed horizontal
line at the user's \code{threshold} (default 0.7).

Overlay of per-cluster correlation curves across drop proportions.
One colour per sub-network; ribbons show mean +/- sd across
iterations. Dashed horizontal line marks the stability threshold
(default 0.7).
}
\details{
Complements \code{\link[=centrality_stability]{centrality_stability()}}: that function asks whether
centrality \emph{rankings} are stable; this one asks whether the \emph{edge-weight
structure itself} is stable. For MCML-derived networks where each row
of \verb{$data} is one transition, this is case-dropping of \strong{edges}.

For each \code{drop_prop} p and each iteration, a size \code{n_cases * (1 - p)}
subset of \verb{$data} rows is selected \strong{without replacement}, the network
is re-estimated using the same method/scaling/threshold as the input,
and the upper/lower-triangle (directed: all off-diagonal entries) of
the new weight matrix is flattened and correlated with the
corresponding vector of the original matrix. The correlation method
defaults to Spearman for robustness to the wide dynamic range of
transition probabilities.

Unlike bootstrap CIs, case-dropping does not estimate sampling variance
and so does not rely on the i.i.d. assumption. This makes it the
appropriate robustness check for \strong{edgelist-derived} networks (where
rows of \verb{$data} lack actor grouping), since dropping rows at random is
a well-posed operation regardless of within-actor correlation.
}
\examples{
seqs <- data.frame(
  V1 = sample(LETTERS[1:4], 30, TRUE),
  V2 = sample(LETTERS[1:4], 30, TRUE),
  V3 = sample(LETTERS[1:4], 30, TRUE)
)
net <- build_network(seqs, method = "relative")
es  <- casedrop_reliability(net, iter = 50, drop_prop = c(0.1, 0.3, 0.5),
                      seed = 1)
print(es)

}
\references{
Epskamp, S., Borsboom, D., & Fried, E. I. (2018). Estimating
psychological networks and their accuracy: A tutorial paper.
\emph{Behavior Research Methods} 50(1), 195-212.
\doi{10.3758/s13428-017-0862-1}
}
\seealso{
\code{\link[=centrality_stability]{centrality_stability()}}, \code{\link[=bootstrap_network]{bootstrap_network()}}.
}
