% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/subtests.R
\name{resolve_dif}
\alias{resolve_dif}
\title{Resolve differential item functioning by iterative item splitting}
\usage{
resolve_dif(
  fit,
  factors = NULL,
  alpha = 0.05,
  p_adjust = "BH",
  min_anchors = NULL,
  max_splits = NULL
)
}
\arguments{
\item{fit}{A fitted object from \code{\link{rasch}} carrying person
factors.}

\item{factors}{Person factors to test, as in \code{\link{dif_anova}};
defaults to every nominated factor.}

\item{alpha}{Significance level for the adjusted probabilities.}

\item{p_adjust}{Multiplicity adjustment across items each round.}

\item{min_anchors}{Minimum number of original items to leave unsplit; the
procedure stops before the anchor set falls below this (pervasive DIF is
not artificial DIF). Default \code{max(3, items / 4)}.}

\item{max_splits}{Hard cap on the number of splits. Default: the number
of items.}
}
\value{
A list of class \code{"rasch_resolve_dif"}: the final resolved
  \code{fit}, the \code{splits} performed (order, item, factor, partial
  eta-squared, DIF magnitude in logits), the \code{stopped} reason, and
  the residual \code{dif} table for the final fit.
}
\description{
Splits DIF items one at a time, largest effect first, refitting after
each split, until no item shows significant DIF (or the anchor set would
fall too low). Splitting the item with the largest real DIF first
removes the artificial DIF it induces on other items (Andrich & Hagquist
2012, 2015), so the procedure resolves genuine DIF without chasing the
artificial DIF that a single simultaneous pass would flag. Each split
resolves the item into one copy per group (or per factor-combination
cell for an interaction), with independent locations and thresholds, so
both uniform and non-uniform DIF are resolved together.
}
\examples{
set.seed(1); n <- 600
d <- seq(-2, 2, length.out = 8); g <- rep(c("a", "b"), each = n / 2)
sh <- matrix(0, n, 8); sh[g == "b", 3] <- 1.2      # one strong DIF item
X <- matrix(rbinom(n * 8, 1, plogis(outer(rnorm(n), d, "-") - sh)), n, 8)
colnames(X) <- paste0("I", 1:8)
fit <- rasch(data.frame(X, grp = g), factors = "grp")
resolve_dif(fit)$splits
}
\references{
Andrich, D., & Hagquist, C. (2012). Real and artificial
  differential item functioning. \emph{Journal of Educational and
  Behavioral Statistics}, 37(3), 387-416.
}
