% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api-plotting.R
\name{plot_marginal_pairwise}
\alias{plot_marginal_pairwise}
\title{Plot strict pairwise local-dependence follow-up using base R}
\usage{
plot_marginal_pairwise(
  x,
  diagnostics = NULL,
  metric = c("exact", "adjacent"),
  top_n = 20,
  facet = NULL,
  main = NULL,
  palette = NULL,
  label_angle = 45,
  preset = c("standard", "publication", "compact", "monochrome"),
  draw = TRUE
)
}
\arguments{
\item{x}{Output from \code{\link[=fit_mfrm]{fit_mfrm()}} or \code{\link[=diagnose_mfrm]{diagnose_mfrm()}}.}

\item{diagnostics}{Optional output from \code{\link[=diagnose_mfrm]{diagnose_mfrm()}} when \code{x} is \code{mfrm_fit}.}

\item{metric}{\code{"exact"} or \code{"adjacent"}.}

\item{top_n}{Maximum level pairs shown.}

\item{facet}{Optional facet name used to keep only matching pairwise rows.}

\item{main}{Optional custom plot title.}

\item{palette}{Optional named color overrides. Recognized names: \code{ok}, \code{flag}.}

\item{label_angle}{X-axis label angle.}

\item{preset}{Visual preset (\code{"standard"}, \code{"publication"}, \code{"compact"}, or \code{"monochrome"}).}

\item{draw}{If \code{TRUE}, draw with base graphics.}
}
\value{
A plotting-data object of class \code{mfrm_plot_data}.
}
\description{
Plot strict pairwise local-dependence follow-up using base R
}
\details{
This helper visualizes the strict pairwise local-dependence follow-up derived
from posterior-integrated expected exact and adjacent agreement.

The \code{"exact"} view ranks level pairs by the absolute exact-agreement
standardized residual. The \code{"adjacent"} view uses the adjacent-agreement
standardized residual instead. Both are exploratory corroboration screens for
strict marginal-fit flags.
}
\section{Interpreting output}{

\itemize{
\item Positive bars mean the observed agreement exceeded the posterior-expected
agreement for that level pair.
\item Negative bars mean the observed agreement fell below the posterior-expected
agreement.
\item Red bars indicate the pair exceeded the current strict-warning threshold.
}
}

\section{Typical workflow}{

\enumerate{
\item Fit with \code{\link[=fit_mfrm]{fit_mfrm()}} using \code{method = "MML"} for \code{RSM} / \code{PCM}.
\item Run \code{\link[=diagnose_mfrm]{diagnose_mfrm()}} with \code{diagnostic_mode = "both"}.
\item Use \code{plot_marginal_pairwise()} to inspect level pairs behind pairwise
local-dependence flags.
\item Corroborate with legacy diagnostics, design review, and substantive
interpretation before making claims.
}
}

\section{Further guidance}{

For a plot-selection guide and a longer walkthrough, see
\link{mfrmr_visual_diagnostics} and
\code{vignette("mfrmr-visual-diagnostics", package = "mfrmr")}.
}

\examples{
\donttest{
toy <- load_mfrmr_data("example_core")
fit <- fit_mfrm(
  toy,
  "Person",
  c("Rater", "Criterion"),
  "Score",
  method = "MML",
  quad_points = 7,
  maxit = 30
)
diag <- diagnose_mfrm(fit, residual_pca = "none", diagnostic_mode = "both")
p <- plot_marginal_pairwise(diag, draw = FALSE, preset = "publication")
p$data$preset
if (interactive()) {
  plot_marginal_pairwise(
    diag,
    metric = "adjacent",
    draw = TRUE,
    preset = "publication"
  )
}
}
}
\seealso{
\code{\link[=diagnose_mfrm]{diagnose_mfrm()}}, \code{\link[=plot_marginal_fit]{plot_marginal_fit()}}, \link{mfrmr_visual_diagnostics}
}
