% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/S3fitted.R
\name{residuals}
\alias{residuals}
\alias{residuals.MIRT}
\alias{residuals.MGPCM}
\alias{residuals.MGGUM}
\alias{residuals.FCMIRT}
\alias{residuals.FCDCM}
\alias{residuals.FCGDINA}
\alias{residuals.FCGGUM}
\alias{residuals.TIRT}
\title{S3 Methods: residuals}
\usage{
\method{residuals}{MIRT}(object, type = c("raw", "pearson", "deviance"), ...)

\method{residuals}{MGPCM}(object, type = c("raw", "pearson", "deviance"), ...)

\method{residuals}{MGGUM}(object, type = c("raw", "pearson", "deviance"), ...)

\method{residuals}{FCMIRT}(object, type = c("raw", "pearson", "deviance"), ...)

\method{residuals}{FCDCM}(object, type = c("raw", "pearson", "deviance"), ...)

\method{residuals}{FCGDINA}(object, type = c("raw", "pearson", "deviance"), ...)

\method{residuals}{FCGGUM}(object, type = c("raw", "pearson", "deviance"), ...)

\method{residuals}{TIRT}(object, type = c("raw", "pearson", "deviance"), ...)
}
\arguments{
\item{object}{A fitted model object.}

\item{type}{Character; \code{"raw"} (default), \code{"pearson"}, or
\code{"deviance"}.}

\item{...}{Additional arguments (currently ignored).}
}
\value{
A numeric matrix with the same dimensions as the corresponding
\code{fitted} output.
}
\description{
Compute residuals from fitted \pkg{ForceChoice} model objects.
Supported types are raw (response), Pearson, and deviance residuals.
}
\details{
Residual types follow standard GLM conventions for binary responses:
\itemize{
\item \strong{raw}: \eqn{e_{ij} = y_{ij} - \hat{p}_{ij}}
\item \strong{Pearson}:
\eqn{r_{ij} = e_{ij} / \sqrt{\hat{p}_{ij}(1-\hat{p}_{ij})}}
\item \strong{deviance}:
\eqn{d_{ij} = \mathrm{sign}(e_{ij}) \sqrt{2\left[y_{ij}\log\frac{y_{ij}}{\hat{p}_{ij}} + (1-y_{ij})\log\frac{1-y_{ij}}{1-\hat{p}_{ij}}\right]}}
}
For polytomous and forced-choice models, residuals are computed on a
category-indicator matrix. This treats ordered categories and nominal
forced-choice response patterns as multinomial outcomes rather than as
numeric scores.
}
\section{Methods (by class)}{
\itemize{
\item \code{residuals(MIRT)}: Residuals for \code{MIRT} objects.

\item \code{residuals(MGPCM)}: Residuals for \code{MGPCM} objects.

\item \code{residuals(MGGUM)}: Residuals for \code{MGGUM} objects.

\item \code{residuals(FCMIRT)}: Residuals for \code{FCMIRT} objects.

\item \code{residuals(FCDCM)}: Residuals for \code{FCDCM} objects.

\item \code{residuals(FCGDINA)}: Residuals for \code{FCGDINA} objects.

\item \code{residuals(FCGGUM)}: Residuals for \code{FCGGUM} objects.

\item \code{residuals(TIRT)}: Residuals for \code{TIRT} objects.

}}
