residuals: S3 Methods: residuals

residualsR Documentation

S3 Methods: residuals

Description

Compute residuals from fitted ForceChoice model objects. Supported types are raw (response), Pearson, and deviance residuals.

Usage

## S3 method for class 'MIRT'
residuals(object, type = c("raw", "pearson", "deviance"), ...)

## S3 method for class 'MGPCM'
residuals(object, type = c("raw", "pearson", "deviance"), ...)

## S3 method for class 'MGGUM'
residuals(object, type = c("raw", "pearson", "deviance"), ...)

## S3 method for class 'FCMIRT'
residuals(object, type = c("raw", "pearson", "deviance"), ...)

## S3 method for class 'FCDCM'
residuals(object, type = c("raw", "pearson", "deviance"), ...)

## S3 method for class 'FCGDINA'
residuals(object, type = c("raw", "pearson", "deviance"), ...)

## S3 method for class 'FCGGUM'
residuals(object, type = c("raw", "pearson", "deviance"), ...)

## S3 method for class 'TIRT'
residuals(object, type = c("raw", "pearson", "deviance"), ...)

Arguments

object

A fitted model object.

type

Character; "raw" (default), "pearson", or "deviance".

...

Additional arguments (currently ignored).

Details

Residual types follow standard GLM conventions for binary responses:

  • raw: e_{ij} = y_{ij} - \hat{p}_{ij}

  • Pearson: r_{ij} = e_{ij} / \sqrt{\hat{p}_{ij}(1-\hat{p}_{ij})}

  • deviance: 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.

Value

A numeric matrix with the same dimensions as the corresponding fitted output.

Methods (by class)

  • residuals(MIRT): Residuals for MIRT objects.

  • residuals(MGPCM): Residuals for MGPCM objects.

  • residuals(MGGUM): Residuals for MGGUM objects.

  • residuals(FCMIRT): Residuals for FCMIRT objects.

  • residuals(FCDCM): Residuals for FCDCM objects.

  • residuals(FCGDINA): Residuals for FCGDINA objects.

  • residuals(FCGGUM): Residuals for FCGGUM objects.

  • residuals(TIRT): Residuals for TIRT objects.


ForceChoice documentation built on Sept. 13, 2026, 1:06 a.m.